Question

It's now 925*1139,I want to change it to 90*110.

Was it helpful?

Solution

try the imagecopyresampled PHP function or the imagecopyresized function from the GD library.

OTHER TIPS

Basically using GD is pretty easy once you know what to do.

$uploadedfile = $_FILES['file']['tmp_name']; 
$src = imagecreatefromjpeg($uploadedfile);        
list($width, $height) = getimagesize($uploadedfile); 

$tmp = imagecreatetruecolor(800, 600); 

$filename = '/path/to/images/' . $_FILES['file']['name'];

imagecopyresampled($tmp, $src, 0, 0, 0, 0, 800, 600, $width, $height); 
imagejpeg($tmp, $filename, 100);

Again check the blog for details.

here's a resizing class called SimpleImage that you can use. Or take a look at the source and see how they tackle the problem:

SimpleImage Code

I haven't done PHP in a while (why am I even in this tag?) but you should check out GDLib. iirc, its better integrated than imagemagick.

http://php.net/manual/en/book.image.php

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top