tags:

views:

169

answers:

6

Possible Duplicate:
Resize a picture to a fixed size

How to resize an image in PHP?

+5  A: 

Try the GD and Image functions, or - if you want something more than just that - a library like ImageMagick.

Peter Kruithof
+3  A: 

You may use imagemagick, call it via exec("convert ...") from php, copy it to the desired location and access it.

Thariama
Good suggestion, I've also used it. Requires exec() access for PHP though and many virtual hosting companies have denied it.
Ain
ImageMagick offers a PHP API so there is no need for a less secure `exec()`: http://www.imagemagick.org/script/api.php?ImageMagick=bi9l24vaisg19eu5racue3gsh6#php
0xA3
Through PHP API you've got a memory cap that kicks in pretty fast esp. considering the low memory of virtually hosted sites and users uploading their 10 MP images.
Ain
A: 

I'm using Image_Transform PEAR package for it. A ready-made thing that's pretty solid at this task.

Ain
A: 

You may use codeigniter framework which provides you a lot of tools, including image manipulation. Otherwize, the main idea is to:

Aif
+1  A: 

You can also do like I do and use a lightweight framework like flourishlib.com where everything is nicely wrapped in a class fImage, example from documentation:

// Saving as a 60 quality JPEG
$image2 = new fImage('./example.gif');
$image2->resize(250, 0);
$image2->saveChanges('jpeg', 60);

It will work with both GD and ImageMagick

Michael
A: 

Here is the code to a Image resize script which i wrote a while back. It resizes the image and keeps the aspect ratio.

This script uses the core GD library to resize. So hopefully your host already got it installed.

I did some fast translation on the documentation from swedish to english. So it might not be perfect.

Hope it works!

hellozimi