 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Sameer Borate's Blog: Unpacking binary data in PHP
by Chris Cornutt September 22, 2010 @ 10:45:52
Sameer Borate has a new post to his blog today talking about a method for unpacking binary data directly in PHP - specifically in working with images.
To set the stage we will start with a programming problem, this will keep the discussion anchored to a relevant context. The problem is this : We want to write a function that takes a image file as an argument and tells us whether the file is a GIF image; irrelevant with whatever the extension the file may have. We are not to use any GD library functions.
He shows how to use the unpack function to open up the file and pull out the raw data - including the header information that tells you what kind of file it is you're working with. There's also an example of unpacking the header contents and grabbing things like height, width and the aspect of the image.
voice your opinion now!
unpack binary data tutorial gif image
DevShed: Creating Image Streams from Existing Graphics with the GD Library in PHP
by Chris Cornutt August 20, 2007 @ 11:04:00
DevShed continues its look at using the GD graphics library in PHP with the second part of the tutorial series, this time focusing on the creation of images from existing images (and their streams).
As I stated at the end of the previous article of this series, the GD extension comes packaged with many other useful functions, which indeed deserve a close and detailed look. Thus, in this second tutorial I'll show you how to create different types of image streams from existing graphics, but in this case limiting the process to building GIF, JPG and PNG images.
They work through each of the types (GIF, JPG and PNG) creating an new one from a previous "clouds" image of the same type (a GIF out of a GIF, a JPG from a JPG, etc).
voice your opinion now!
tutorial gd graphic create stream png jpg gif existing tutorial gd graphic create stream png jpg gif existing
Builder.com.au: PHP exploit code plants itself in GIF
by Chris Cornutt June 22, 2007 @ 12:41:00
Builder.com.au has a new article today about the recent image issue - the PHP code embedded inside the GIF - that's come up on several sites.
The exploit code slipped through the site's defenses with the aid of a legitimate image at the beginning of the file, according to a blog post on the Sans Institutes's Internet Storm Center. [...] Malicious attackers planted PHP coded exploit script within an image file. PHP is often used as a programming language to create dynamic Web sites.
The article reports that, while this exploit hasn't happened much, the occurrences of it's use are growing with victims in a wide range of classifications - from small personal sites out to a certain major image hosting site. This same issue was discussed here on the PHPClasses.org website as well.
voice your opinion now!
gif exploit image script embed gif exploit image script embed
PHPClasses.org: PHP security exploit with GIF images
by Chris Cornutt June 20, 2007 @ 12:57:00
On the PHPClasses site today, there's a new post that points out an issue that could happen with dyanamic GIF creation in a PHP script leading to a security exploit.
Manuel Lemos writes:
The problem that was discovered is that you can insert PHP code in the middle of a GIF image. That would not be a problem if it was not for the insecure ways some developers use to serve images upload by their users. Usually, uploaded files are moved to a given directory. If the site then serves the images directly from that directory and preserve the original file name, the site may be open for security exploits.
The problem comes when a user decides to upload an "image" file that's actually a PHP script (ending in PHP even) to the remote system. When this is outputted, it's placed inside the image tag and executed with each page load. Manuel offers a suggestion to prevent the issue - protecting the images directory and using readfile to grab the contents of the file to output rather than just a straight echo.
voice your opinion now!
security exploit image gif dynamic readfile output security exploit image gif dynamic readfile output
PHPClasses.org: CAPTCHA harder to break using animations
by Chris Cornutt December 07, 2006 @ 08:28:00
PHPClasses.org is spotlighting another package from their site today - this time it's a CAPTCHA class that takes things a step further and introduces animation into the mix to make it even harder for bots to get through.
Laszlo Zsidi is a PHP Web developer that has written an harder to break CAPTCHA solution. It consists in generating animated GIF images that exhibit the validation text.
Since the text never appears all at once in each of the animated frames, this solution certainly raises the bar in terms of difficulty for the robots to guess the validation text, making it very hard to defeat, if possible at all.
You can check out the class here, including a sample animated gif file and a download of everything you'll need to get started.
voice your opinion now!
captcha animation gif validation spam bot captcha animation gif validation spam bot
PHPClasses.org: 3D graphics in pure PHP
by Chris Cornutt November 08, 2006 @ 08:13:00
As spotlighted by the folks over on PHPClasses.org, there's a developer, László Zsidi, who has contributed several packages to the repository - including some that work to create 3D images with just the built-in functions PHP provides.
He has developed several pure PHP components that implement impressive 3D animated graphics, like a 3D objects rendering engine, emulate a waving flag or the reflex of an image near a lake. The generated frames are combined into a single animated GIF with another pure PHP component also written by László. All these components were nominated to the PHP Programming Innovation Award for the evident creativity, demonstrating that PHP can be used for non-trivial software applications.
Some of the libraries in the listing include:
voice your opinion now!
3d graphics builtin functionality reflect gif animation images 3d graphics builtin functionality reflect gif animation images
Technobabbler.com: making a radar loop with PHP
by Chris Cornutt September 07, 2006 @ 13:36:21
On the Technobabbler blog, there's a quick look at their creation of a (weather) radar loop they could view on their cell phone.
I used the great mobile site from the NWS, but it still didn't give me the effect I wanted. And hey, I'm already filling a database with weather observations and radar images! So I decided to see what it would take to make a custom radar loop that I could get to at any given moment. The Treo can display animated gif files, so that seemed like the most efficient solution. The question is, how do we create an animated gif using PHP?
To answer the question, he found this script ("GIF images into animated GIF with native PHP class") and used it to create a simple script to grab the GIF images and combine them into a single animated image suitable for viewing in any browser. He includes the script used to generate it as well as an example of the result and how it looks on the phone.
voice your opinion now!
radar loop graphic gif animated class native script radar loop graphic gif animated class native script
|
Community Events
Don't see your event here? Let us know!
|