Re: problems with several JPEGs in GD2

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

 



Mario Lopez wrote:
> I've noticed that there is a group of JPEG files
> that cannot be operated with GD2 functions.
>
> For example, if you try to imagecreatefromjpeg("my.jpg") it
> replies:
>
> Warning: imagecreatefromjpeg(): 'my.jpg' is not a valid JPEG file
> in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 20
>
> (this is not a scripting error, it works with lots of other jpegs)
>
> Meanwhile the same my.jpg file can be shown in web browser by
> HTML tag <img src="my.jpg">, can be opened in PhotoShop.. and other
> programs..
>
> But GD2 thinks that it is not a valid JPEG..
>
> Any suggestions how to deal with these types of JPEGs in GD2?
> Any workaround?

I encountered this recently (except the PhotoShop part), and it turned out
that:

1. The JPEG in question was *NOT* a JPEG at all.
2. The JPEG in question was *REALLY* an .art (ART) file.
3. ART files are an AOL invention in a proprietary format.
4. AOL takes an image (JPEG or GIF)
   Converts it to the other format (GIF or JPEG)
   Blindly chooses the smaller file size,
   Saves it as an .ART file.
   But sometimes "simplifies" life for AOL Users by pretending it's a JPEG
5. So *YOU* end up with a file that ends in .jpg but isn't a JPEG
6. And most/some non-AOL browsers happily display these ART files

The Linux "file" command is what properly identified the file for me, I
*think*...  Not 100% sure on that part.

Oooh, maybe IrfanView was the tool that tipped me off that I was dealing
with a bogus JPEG.  IrfanView Rocks!

Try the GIMP too -- Almost for sure not that, as I was using a Windows box
at the time, so wouldn't have had GIMP installed.  (Yes, I know GIMP runs
on Windows now)

AFAIK, You can "undo" the ART packaging *only* by installing all of AOL
(ugh!) and then opening up the image in their editor and doing a "Save
As..."

It only took me 10 minutes to figure out that after starting AOHell, I
could *CLOSE* the window that looks like a modal dialog that pushes me to
connect/signup with AOL and then I can use the Tools menu (or whatever it
was) to open/edit/save the image.  If you Google for "ART JPEG AOL
Convert" you should find the same pages I did that led me down this path
to success.  YMMV  NAIAA  IANAL

Somebody from the OpenSource community who wants to "fix" this issue by
writing some quick hack utilities to easily identify and un-package ART
files to non-proprietary... errr, less-proprietary, formats would probably
gain a lot of reputation quickly and easily.  I don't grok enough about
image formats to do it myself.

Of course, *YOUR* images may not be ART images, and might just be broken
JPEGs.

They might also be using some fancy JPEG thing that GD2 doesn't support...
Interlacing?  GD2 does that, though, I think...  Maybe something like
that.

So maybe they *ARE* JPEGs, but are using a feature of JPEGs that GD2
doesn't do -- Open up a bunch of "good" images in PhotoShop, and bunch of
"bad" ones and see what they have in common in terms of features like
Interlacing and Gradients (?) and, err, other PhotoShop-y things of which
I'm ignorant.

PhotoShop: I click on the buttons a lot, and if it's pretty, I go on, and
if it's not, I hit "Undo"  I think some monkeys would be better at
PhotoShop than me. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
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