Re: corrupt image when viewed using PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, October 18, 2006 6:44 am, Angelo Zanetti wrote:
> We have written an app in PHP4 that receives images from mobile phones
> that are taken with the camera, we have found a problem that some of
> the
> images are corrupt and we have determined that it is because of Nokia
> VGA cameras that have sent the image, basically the jpegs are fine but
> the extra info that comes with the jpeg is corrupt, therefore PHP wont
> open the image, with all other photos its fine.

Yeah, EXIM and Comments and all that tend to be very funky sometimes.
[sigh]

> We found that i PHP 5 there is a setting that you can change to tell
> PHP
> how strict to be when opening an image. That will work but now we'd
> have
> to change the whole site to be PHP5 compliant and also test it on a
> new
> server which is really alot of work and undesireable.

You probably should begin this process anyway, as you're going to need
to move to 5 sooner or later...

> We also found another possible solution being that we use ImageMagick
> to
> convert the jpeg to a  jpeg, then it will load properly. But now we
> would have to convert each image that comes in and maybe only 10% of
> the
> images come from a Nokia  VGA camera, ImageMagick also has to be run
> from the command line (would this affect the  performance of the
> site?).  Would you suggest  using ImageMagick to convert the images
> each
> time a new one is uploaded? Or does anyone have a better solution for
> this?

Sure.

Run ImageMagick through backticks on the ones that fail, and leave the
rest of your code alone.

Kind of a hack, but think of it as an "import filter" and maybe even
program it generically enough that you *CAN* do more "import filters"
and then you open up a world of possbilities for other image formats
to be supported some day in the future.

You might even be able to "detect" the Nokia VGA images more cheaply
than attempting to open them and failing, so it will look less like a
hack and more like an "import filter"

If the EXIM data truly is not in spec with JPEG standards, you should
file a bug report with Nokia, so maybe they'd fix it...  They can
"push" down a new photo app to the phones, as I understand it.  I
wouldn't count on this happening before launch, but it could save you
even more problems later, not to mention starting a good professional
contact with somebody at Nokia, which can't hurt.

Sometimes "bug" is spelled "opportunity" :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux