cancel
Showing results for 
Search instead for 
Did you mean: 

Nokia JPEG images header info corrupt, how to fix it

Pablos
Newbie
Posts: 9
Registered: ‎24-12-2007

Nokia JPEG images header info corrupt, how to fix it

Dear All,
I'm trying to do PHP uploading of JPEG images.
However, some JPEG images uploaded from certain camera phones, like the Nokia and some Canon cameras, seem to give gd functions some problems.
Example,
  when i open these type of files in The GIMP it says
  '59 extraneous bytes before marker 0xD9 - EXIF data will be ignored"
According to a user's comment in www.php.net there is a little command-line utility called 'jhead' (available @ 'http://www.sentex.net/~mwandel/jhead/') which when ran strips any unwanted extra meta-data that these camera phones add.
My problem is i don't know if I am allowed to upload and run binary commands in my PlusNet cgi space. If i *could* it might save me some hassle as I could call the utility from inside my PHP script and that way 'fix-up' the image. Thing is i don't know if this is possible as I don't know if PlusNet let me run binary executables on my cgi space.
I am *assuming* this is the best way to handle this. Also tried a comment on www.php.net which basically suggests i use a 'cleaning'  function he wrote but it didn't appear to work for the image, and It seemed very simplistic
Anybody know of a better way of solving this? Or alternatively, does anybody know if i can run binary executables in my PlusNet cgi space?
Your help is appreciated.
Many thanks,
Pablo.
2 REPLIES 2
Ben_Brown
Grafter
Posts: 2,839
Registered: ‎13-06-2007

Re: Nokia JPEG images header info corrupt, how to fix it

Quote from: Pablos
...Or alternatively, does anybody know if i can run binary executables in my PlusNet cgi space?

Yes, you can run binaries from the CGI space. If you are running them from within a php script (or similar) they can be anywhere, if you want to run them from a browser they need to be in your cgi-bin directory.
Pablos
Newbie
Posts: 9
Registered: ‎24-12-2007

Re: Nokia JPEG images header info corrupt, how to fix it

Ben,
Thanks for that reply. I have a confession to make, first thing is not so bad and the second thing is somewhere between bad and serious.
Here goes..
Firstly, i went right ahead and did it anyway. I ran a binary executable in my script by using the 'exec' command. I was lucky that it solved my problem as there was a rather awkward 'feature' of PHP's imagecreatefromjpg() which i was having difficulty with. Thanks a lot to you guys for getting back to me and trying to help me on that.  Star.
Second, this is not a nice and i'm deeply sorry for this fact.  I wrote a while loop and i failed to write the code to increment counter while inside the loop. This is unrelatead to the original post, by the way. Anywayz, I opened the page on my browser and was wondering why the heck the browser kept  on 'refreshing' the page.. then i realised something had gone wrong.
My apologies for this, guys, as i know PlusNet provide a great service to us guys and i hate to think that i contributed in some way to the server's mal-operation. I make a very sincere apology for this and hope that i have not done any damage. Needless to say i corrected the problem with the script, ... a simple schoolboy PHP error
I'm very sorry to all that i did that and I will be very careful in future. Smiley
Thanks to all,
Pablo.