animated gifs in perl to php

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
helraizer
Forum Commoner
Posts: 31
Joined: Thu Jun 05, 2008 8:20 pm

animated gifs in perl to php

Post by helraizer »

Hey,

I have a PHP script that I made for an image based shoutbox with emoticons. The problem is that php GD doesn't support animated gifs, yet perl GD does. How would I make it so that I could copy the animated gifs via Perl onto the static image that I made with php? I've tried with php imagecreatefromgif(), which produces a static image. I also tried using the GIFAnimation class from phpclasses to make an animated gif but it returns it as an object or a string, not an image resource. So if I use imagecreatefromstring it will again be static..

Any ideas? I must admit I've not used much Perl before, at all.

Sam
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: animated gifs in perl to php

Post by superdezign »

How does this work? Why can't users just upload images? o_O
helraizer
Forum Commoner
Posts: 31
Joined: Thu Jun 05, 2008 8:20 pm

Re: animated gifs in perl to php

Post by helraizer »

superdezign wrote:How does this work? Why can't users just upload images? o_O
Eh? Maybe I wasn't so clear.

I have an image based shoutbox.

Image

As you can see it has static emoticons. Like a normal shoutbox, but in an image form. I was wondering whether there is any possible way to use Perl GD to animate the gifs within GD (since the files themselves are animated). Then with these animated gifs imagecopymerge them onto the shoutbox image, as I am doing now. Therefore having the emoticons animated on the shoutbox image.

Hope that makes more sense.. Is that possible?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: animated gifs in perl to php

Post by onion2k »

One of the annoying things about PHP's version of GD is that it's a little behind the standalone version (which is what Perl uses). Currently your only option is to code something to read and write animated gifs yourself ... that's very complicated though. If you don't want to do that then you're stuck with static images until PHP catches up. It will one day, but when ... noone knows.

You could try Imagemagick instead of GD I guess. That would mean going back to the drawing board pretty much though - none of your GD code would be much use.
helraizer
Forum Commoner
Posts: 31
Joined: Thu Jun 05, 2008 8:20 pm

Re: animated gifs in perl to php

Post by helraizer »

onion2k wrote:One of the annoying things about PHP's version of GD is that it's a little behind the standalone version (which is what Perl uses). Currently your only option is to code something to read and write animated gifs yourself ... that's very complicated though. If you don't want to do that then you're stuck with static images until PHP catches up. It will one day, but when ... noone knows.

You could try Imagemagick instead of GD I guess. That would mean going back to the drawing board pretty much though - none of your GD code would be much use.
Yeah, I've tried Imagick but my host doesn't have the Imagick class installed, so it won't work. "Cannot initiate class from undefined class imagick" or something like that.

I've devised a way actually, based on the GIFAnimator class, just working now on making it dynamic. I'll let you know if/how it turns out.

Sam
Post Reply