|
Posted by bernie on 10/16/79 11:19
Howdy,
I have an image upload and resize script that I have used on a number of
servers with no issues. I have now use it in a new app that I uploaded
to a new server. I worked fine on my dev server, but when I submit the
POST form to the page that does the resizing the page grids it gears for
a while, then just quits. It is frustrating because I don't get any
errors. The image does upload, but nothing seems to happen after that.
I think I have boiled it down the the "imagecreatefromjpeg" function.
If I comment it out I finally get an error (that relates to it being
commented out). I have also found out that the script works fine with
smaller images (50k or so seems to work), but not with larger images
(600k or so).
It seems to be a problem with the server setup, as it works fine on my
dev server. phpinfo() gives some standard info. It is php 4.3.8 on
freebsd.
Here is the function: If you think more of the code would be helpful
please let me know, I'll post it.
function resize_jpg($img,$img2,$w,$h){
$imagedata = getimagesize($img);
if ($w && ($imagedata[0] < $imagedata[1])) {
$w = ($h / $imagedata[1]) * $imagedata[0];
} else {
$h = ($w / $imagedata[0]) * $imagedata[1];
}
$im2 = imagecreatetruecolor($w,$h);
$image = imagecreatefromjpeg($img); //this is the line that causes
problems
imagecopyresampled ($im2, $image, 0, 0, 0, 0, $w, $h, $imagedata[0],
$imagedata[1]);
imagejpeg($im2, $img2, 100);
}
Any Ideas?
Thanks!
--
bernie
?>
Navigation:
[Reply to this message]
|