Entry
Can ImageCopyResized() be used with jpeg?
Mar 7th, 2001 11:33
Lol Morrisson, Claude Favre,
Yes, here is a function that uses it. It takes a handle to a JPEG, and
size values, and returns the JPEG resized to the values specified.
Hope this helps.
Lol.
<?php
function resize_image ($image, $size_x, $size_y) {
$srcimage = ImageCreateFromJPEG ($image);
$newimage = imagecreate ($size_x, $size_y);
imagecopyresized ($newimage, $srcimage, 0, 0, 0, 0, $size_x,
$size_y, imagesx($srcimage), imagesy($srcimage));
return $newimage;
}
?>