Jump to content

Imagecreatefromstring Problem With False Result


ProblemHelpPlease

Recommended Posts

When using imagecreatefromstring I am getting the following error messages from My scipt with a particular image.Warning: imagecreatefromstring() [function.imagecreatefromstring]: gd-jpeg: JPEG library reports unrecoverable error:Warning: imagecreatefromstring() [function.imagecreatefromstring]: Passed data is not in 'JPEG' format Warning: imagecreatefromstring() [function.imagecreatefromstring]: Couldn't create GD Image Stream out of Data The files is a jpg so should work but the point is the code should return a false result and perform a diferent action that doesnt use imagecreatefromstring. It does this ok but I still get the error message. How do I prevent the error message from appearing.Code is below

$image = imagecreatefromstring($file_contents);if ($image != false){## IF NOT FALSE CODE}else{## IF IS FLASE CODE}{

Link to comment
Share on other sites

I added @ to the $image = imagecreatefromstring($file_contents); lineso$image = @imagecreatefromstring($file_contents);The code still returns FALSE so I can handle the error and @ stops the error message being displayed.I now have another error with the error handling, when using an address to a image but excluding the .jpg(http://www.domain.com/image) the code doesn't return false. Anyone know why this is happening?

Link to comment
Share on other sites

I'm getting "GIF89a€ÿÿÿ!ù,D;" when printing the string passed to the function and "Resource id #6" from the imagecreatefromstring function. I patched the problem by checking for a valid file extension before doing anything with images but it would be helpful to know why false wasn't returned when the address isn't even an image.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...