tags:

views:

476

answers:

4

HI

i need all types of images resize script in php

+4  A: 

If you are on a unix system, I highly recommend checking out ImageMagick and its various interfaces. Fastest and most widely used image processing tools in the world.

Specifically, check out MagickWand, one of the PHP interfaces.

Chaos
+1 for ImageMagick, its dead simple fast and easy and can do anything.
Cem Kalyoncu
A: 

The obvious PHP-based solution would be reading the file with GD, getting the dimensions, calculating the new dimensions, scaling the image and outputting it.

Provided you have the GD extension, that is: http://de3.php.net/manual/en/book.image.php

There's also the Imagic extension which allows pretty straightforward resizing: http://de3.php.net/manual/en/function.imagick-scaleimage.php

Alan
+2  A: 

I would definitely use any wrapper for ImageMagick instead of the PHP GD lib, as the latter require you to set memory pretty darn high, and you're not always allowed to if you rent place at webhotels. ImageMagick has many features as well besides just resizing.

The Fairy
+3  A: 

WideImage is an object-oriented library for image manipulation, written in/for PHP 5. It's a pure-PHP library and doesn't require any external libraries apart from the GD2 extension.

i used it in a private project once, worked reasonably well for me.

Samples

// Chaining operations:
wiImage::load('image.png')->resize(50, 30)->saveToFile('new-image.jpg', 30);

// Load, crop, flip and output to browser in one line (no http headers included):
echo wiImage::load('image.png')->crop(30, 30, '50%', '50%')->flip()->asString('png');

// watermarking
$img = wiImage::load('pic.jpeg');
$watermark = wiImage::load('watermark.jpg');
$new_img = $img->merge($watermark, 40, 80);
Schnalle