JPEG filetype/imagecreatefromjpeg() unrecognized with upload

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
User avatar
IceMetalPunk
Forum Commoner
Posts: 71
Joined: Thu Jul 07, 2005 11:45 am

JPEG filetype/imagecreatefromjpeg() unrecognized with upload

Post by IceMetalPunk »

First, to get it out of the way: I'm using dajoob.com as my server, since Ripway doesn't allow e-mail or uploads via PHP.

I'm working on a Twisted Designs GFX - The Site kind of thing. I have so far gotten it to work where people can upload their own images into a global TDG: The Site gallery, along with artist, title, and description of the image.

It all seemed to work, until I tried a JPEG. The MIME filetype that is being sent to the PHP script for JPEG images is a blank string, instead of the expected "image/jpeg" or even "image/jpg". As well, the imagecreatefromjpeg() function is unknown to PHP on my site, yet all the other imagecreatefrom* functions work. Anyone know why this is happening?

As well, I haven't found a way to create an image resource from a BMP (WBMP is apparently different). Is there one?

-IMP ;) :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

getimagesize() is generally able to determine the common file types. As for BMP, there is nothing native. You can write one (it's a very simple file format, just look on MSDN) or I'd bet someone or yourself could dig one up.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Just curious why you need to make an image resource for BMP files. Are you going to be modifying the file beyond simple resizing & format conversion? If not, you can see if you can install ImageMagick - it has support for BMP files.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
IceMetalPunk
Forum Commoner
Posts: 71
Joined: Thu Jul 07, 2005 11:45 am

Post by IceMetalPunk »

I'll look into getimagesize()

As for BMP, are there functions already online that can do that?

And lastly, I have no control over any PHP extensions, because I have no control over anything on the server but my own files (dajoob.com has all the control :P )

-IMP ;) :)

*EDIT* Well, I found a BMP functions pack online, thanks for telling me that. As for the JPEG, even using getimagesize() to get the filetype, everything is okay except that JPEG's aren't recognized (their filetype is a blank string). Plus, even once I get past that problem, imagecreatefromjpeg() isn't a recognized function either... :(
Post Reply