Hello, I use the function imagecreatefromjpeg() to create thumbnails of my pictures. This is the code I use :
<?php function thumbnail($i,$nw,$p,$nn) { $img=imagecreatefromjpeg("$i"); $ow=imagesx($img); $oh=imagesy($img); $scale=$nw/$ow; $nh=ceil($oh*$scale); $newimg=imagecreate($nw,$nh); imagecopyresized($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh); imagejpeg($newimg, $p.$nn); return true; } #thumbnail(filetouse,newwidth,newpath,newname); thumbnail("/img/x.jpg",100,"/img/thm/","xt.jpg"); ?> It works for some of my pictures, but with some pictures the result is an imagefile with filesize zero. When I check the log files then I see that these lines has occured: [11-May-2004 23:16:15] PHP Warning: imagecreatefromjpeg() [<a href='http://www.php.net/function.imagecreatefromjpeg'>function.imagecreatef romjpeg</a>]: '/home/infos/domalle/miweb/pizias/photodir/6.jpg' is not a valid JPEG file in /home/infos/domalle/miweb/pizias/TestOnResize2/resize.php on line 42 [11-May-2004 23:16:15] PHP Warning: imagesx(): supplied argument is not a valid Image resource in /home/infos/domalle/miweb/pizias/TestOnResize2/resize.php on line 43 [11-May-2004 23:16:15] PHP Warning: imagesy(): supplied argument is not a valid Image resource in /home/infos/domalle/miweb/pizias/TestOnResize2/resize.php on line 44 [11-May-2004 23:16:15] PHP Warning: Division by zero in /home/infos/domalle/miweb/pizias/TestOnResize2/resize.php on line 45 [11-May-2004 23:16:15] PHP Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home/infos/domalle/miweb/pizias/TestOnResize2/resize.php on line 49 The only difference that I can find between imagefiles with which it works and the ones where it does not work is the filesize. An image file with which it works : 60 Kb An image file with which it doesn't work : 1400 Kb Could someone please advice me on a solution that works in all cases ? Thanks in advance, Dominique -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php