PHP crashes on imagecreatefromjpeg()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
abdabs
Forum Newbie
Posts: 7
Joined: Tue Aug 08, 2006 6:26 am

PHP crashes on imagecreatefromjpeg()

Post by abdabs »

I have a picture upload script that runs smoothly, untill I tried uploading jpeg from my digital camera. The same problem also happend for my friends camera picture too, too different brands. I'am not quite sure what model it was, but Olympus defently. (I lost my camera...)

Size is not a matter, done some testes on that.. and my upload limits in php.ini is far beyond the pictures size.

The script crashes on imagecreatefromjpeg(), I've no idea how to fix it.. I read some comments on the issue at http://php.net/imagecreatefromjpeg , something about the image is not fully build. But that didn't help me out..

Code: Select all

$im = imagecreatefromjpeg($_FILES['upload_pic']['tmp_name']);
There is a program called: jhead that might solve the problem, but unfortnatly I don't the possibility to install it:
jhead: http://www.sentex.net/~mwandel/jhead/

Is there anything I can do, to fix this problem? So that I can upload my cameras jpeg's too..

Thanks.


PHP version: PHP Version 4.4.0-pl1-gentoo
GD: bundled (2.0.28 compatible)
User avatar
php3ch0
Forum Contributor
Posts: 212
Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK

Post by php3ch0 »

correctme if i'm being stupid here but...

If this is a large file to be uploaded from a jpeg. Will php timeout after 30 seconds and fail the upload?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

knowing the specific error message you are getting would help to direct you to a solution.
abdabs
Forum Newbie
Posts: 7
Joined: Tue Aug 08, 2006 6:26 am

RE

Post by abdabs »

Nope, there are now time up problem.. have set that to large number, and tested for "working jpegs" that are > 1MB.

I don't get any error messages, because php just freeze out/crashes.. I tested the script, by moving a: die("I got this far"); and found out that imagecreatefromjpeg stopped the script with these strange jpegs.

But is there any other way I wan print error message for this case?

Is there alternatives to imagecreatefromjpeg() that does the same thing?
Post Reply