Simple Image Resize in php
by Prabakaran[ Edit ] 2012-05-28 15:33:32
header('Content-Type: image/jpeg');
$w=100;
$h=100;
$filename = 'picture.jpg';
for($i=0;$i<10;$i++){
$rfname="images/re$i.jpg";
resize($filename,$w,$h,$rfname);
}
function resize($filename,$w,$h,$rfname){
list($width, $height) = getimagesize($filename);
$image_p = imagecreatetruecolor($w,$h);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $w, $h, $width, $height);
imagejpeg($image_p,'', 100);
imagejpeg($image_p,$rfname);
}