This script allows you to save, resize, crop and output your images.
include 'class.Image.php';
Now you can use any of its methods
Image::from('image.jpg')
// width, height, crop
->resize_to(400, 300, true)
->save('image.400x300.jpg');
$image = Image::from('image.png');
$image
->resize_to($image->width / 2, $image->height / 2)
->save('image.half.png');
Image::from('image.jpg')->resize_to(100, 100, true)->output();
If you want to manually set the Content-Type
header, just pass false as argument to $output:
header("Content-Type: image/jpeg");
Image::from('imagen.jpg')->output(false);
The author of this little script is Emilio Cobos, a 17 year old web designer and web developer from Salamanca (Spain).