Iv been creating some thumbnail pictures using imagecopyresampled() it works fine on most pics untill it gets to large size pictures (width/height) and then it stops working 🙁 i know that the the pic size isnt to much as its about 250kb and iv been resizing some well over that. as the soloution then would be to set memory up higher in php.ini ini_set('memory_limit', '30M'); so im guessing it has something to do with the width of the picture which is 2039 x 1631 pixels im trying to resize to 100 x 100 pixels both input and output of the pic is in jpg Does anyone know if there is a height/width pixel limit? if so what is it? 🙂
Imagecopyresampled() ?
Started on the old forum in November 2008 · view the original in the archive · old links redirect here
iv set limit at 1000 pixels squared but if anyone knows any differnt would be much apprecaited
QUOTE
so im guessing it has something to do with the width of the picture which is 2039 x 1631 pixels im trying to resize to 100 x 100 pixels
100x100 resized image from 2039x1631 image wont produce an actual resized image. You should resize it uniformly like 203.9x163.1 .
So try to think simply like this
<?php
$c = "10"; //// changable
$image = "test.jpg"; /// gif/png
$rukiya = getimagesize($image);
$a = $rukiya[0]/$c;
$b = $rukiya[1]/$c;
echo "<img src=\"$image\" height=\"$a\" weight=\"$b\"/>";
?>
yeah unfortunately load time doing it that way is to long 🙁
would running from 2039x1631 to 1000 x 1000 pixels work? and then running a second time to 100 x 100 ? 🙂
guess there is only 1 way to find out........ lol
<?php
/* How to use?
Simple, image.php?file=imageurl
or image.php?file=http://file.com/images/image.jpg
*/
//adjust size
$height= 100;
$width= 100;
$filename= $_GET["file"];
// Content type
header('Content-type: image/jpeg');
if(!$filename)
$filename="./images/nopic.jpg";
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
imagejpeg($image_p, null, 100);
ImageDestroy ($image_p);
?>
Try this script, make it something like image.php or something. This should work!