Jump to content

imagecreatefromjpeg() dies for some images..


neoform

Recommended Posts

<?php
function LoadJpeg($imgname)
{
   $im = @imagecreatefromjpeg($imgname); /* Attempt to open */
   if (!$im) { /* See if it failed */
       $im  = imagecreatetruecolor(150, 30); /* Create a black image */
       $bgc = imagecolorallocate($im, 255, 255, 255);
       $tc  = imagecolorallocate($im, 0, 0, 0);
       imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
       /* Output an errmsg */
       imagestring($im, 1, 5, 5, "Error loading $imgname", $tc);
   }
   return $im;
}
header("Content-Type: image/jpeg");
$img = LoadJpeg("bogus.image");
imagejpeg($img);
?> 

didn't work.

 

It always fails on the line with imagecreatefromjpeg().. so this dies right here:

$im = @imagecreatefromjpeg($imgname); /* Attempt to open */

 

 

if i try reloading the page after i get a blank page, i get this error:

WARNING - imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: (line: 61)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.