beta it republik » News

News

Untitled Document
News

Making a Radar Loop with PHP

Over at Technobabbler is a new post that talks about how to pull up a (weather) radar loop. "I used the mobile site from the NWS, but it still didn’t give me the effect I wanted. So I decided to see what it would take to make custom radar loop that I could use at any given moment. The Treo can display animated gif files, so that seemed like the most efficient solution. The question is how do you create an animated gif using PHP?” the author questions.

The author says you need to read in the images and feed them to the GifMerge class. According to the author, there are more ways of writing the code, but this was quick and painless.

One issue he had was that the images he scraped regularly were too large, and when you merge ten of them into an animated GIF, you end up with an image that is a little bigger than most handheld devices can to deal with. Not to mention, a GPRS connection. So to get around that, he used the imagecopyresampled function to cut out the portion of the image which is most important. He then saved the cut out image into a ‘loop’ directory as ten separate ‘frame’ files. After that, it’s straightforward to follow the GifMerge example to create the image.



Comments



Name:




Comment:

Captcha Verification !
captcha_image