gif resize support? Anyone? Anyone?

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
bznutz
Forum Commoner
Posts: 58
Joined: Mon Dec 09, 2002 9:52 pm
Location: Here
Contact:

gif resize support? Anyone? Anyone?

Post by bznutz »

First of all, with all the gifs that still exist on the net it hardly seems intelligent to remove gif support from GD.
That being said, how do I make dynamic thumbnails of gifs if all I have to work with is GD? Is there a way to suplement with an older library or do I have to completely uninstall my current GD and install the older (I would like to avoid this).
Perhaps someone knows of an algorithm for resizing gifs so I can bypass GD altogether?
User avatar
redcircle
Forum Commoner
Posts: 43
Joined: Fri Jan 31, 2003 8:47 pm
Location: michigan, usa

Post by redcircle »

Imagemagick has support for the .gif format. http://www.imagemagick.org
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Re: gif resize support? Anyone? Anyone?

Post by twigletmac »

bznutz wrote:First of all, with all the gifs that still exist on the net it hardly seems intelligent to remove gif support from GD.
Well they didn't do it because they wanted to. From http://www.rime.com.au/gd/:
The original GD library allowed developers to manipulate GIF files. It was (and is) open source freeware developed by Thomas Boutell of Boutell.Com, Inc.

As you may or may not be aware, Unisys holds the patents on the LZW compression technology used in GIF files. Despite the fact that they were made open and freely available for several years, and as a result became a de-facto standard, in 1996 (I think) Unisys decided to enforce it's patent.

The result of this is that libraries like GD, which are open source, free development projects, created, basically, out of the good nature of it's original author, could no longer use the GIF format.

As a result, all support for GIF was removed in version 1.6 of the GD library. This is the only correct solution for someone that lives in Canada or the US.
Mac
User avatar
bznutz
Forum Commoner
Posts: 58
Joined: Mon Dec 09, 2002 9:52 pm
Location: Here
Contact:

Post by bznutz »

I hate that type of crap.
God bless that company. Right in the mouth.
User avatar
puckeye
Forum Contributor
Posts: 105
Joined: Fri Dec 06, 2002 7:26 pm
Location: Joliette, QC, CA
Contact:

Post by puckeye »

The thing here...

If we un-lzw the gif file do we get anything usable on the PHP stand point? What I mean is that if the gif file is uncompressed could we load the code using imagecreatefromstring? And then use either imagejpg or imagepng?
User avatar
bznutz
Forum Commoner
Posts: 58
Joined: Mon Dec 09, 2002 9:52 pm
Location: Here
Contact:

Post by bznutz »

I don't think so. If I remember correctly the gif is still encoded like a gif eventhough it's decompressed, so to a jpeg engine it would be jibberish.
Or would it?
It's worth a try...
User avatar
puckeye
Forum Contributor
Posts: 105
Joined: Fri Dec 06, 2002 7:26 pm
Location: Joliette, QC, CA
Contact:

Post by puckeye »

But then what is the use of imagecreatefromstring??
User avatar
bznutz
Forum Commoner
Posts: 58
Joined: Mon Dec 09, 2002 9:52 pm
Location: Here
Contact:

Post by bznutz »

uh, to create a supported format from a string?
dbcooper
Forum Newbie
Posts: 7
Joined: Tue Jan 14, 2003 4:06 am

Post by dbcooper »

There is an ImageMagick extension (imagick) for PHP available on PEAR: http://pear.php.net/package-info.php?pacid=76

It is still in beta, but if you have some time to recompile PHP and add the extension to your setup, you can call many of the ImageMagick library functions directly from PHP. From my experience, ImageMagick still fully supports GIF files, but it does not use the patented compression method.

In a nutshell, this means that the GIFs you output will be much larger. You will likely have better results saving the resized images as PNGs (if you need non-lossy compression), but I don't know your exact situation and requirements.

-db
User avatar
bznutz
Forum Commoner
Posts: 58
Joined: Mon Dec 09, 2002 9:52 pm
Location: Here
Contact:

Post by bznutz »

That sounds good. I will see if there are any windows php dlls for that.
Recompiling is a bad thing in Windows, generally. If I still had my Linux server I would recompile in a second.
User avatar
puckeye
Forum Contributor
Posts: 105
Joined: Fri Dec 06, 2002 7:26 pm
Location: Joliette, QC, CA
Contact:

Post by puckeye »

bznutz wrote:uh, to create a supported format from a string?
I understand that, but where does that string come from? A database?
Post Reply