Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sameer Borate:
Unpacking binary data in PHP
Apr 04, 2018 @ 14:19:40

Sameer Borate has a new post to his Code Deisel blog showing how to unpack binary data in PHP making use of the pack and unpack functions.

Working with binary files in PHP is rarely a requirement. However when needed the PHP ‘pack’ and ‘unpack’ functions can help you tremendously. 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 starts by briefly covering the "metadata" that binary files contain in their headers about the type of file and, more specifically, what the content for a GIF looks like. He follows this with an example of using unpack to provide a readable version of the file's binary content. He then uses this in an is_gif function to read the contents of a file, check the header format and ensure the version is either GIF87a or GIF89a. He also includes the code for another method to get attributes about the file like height, width and the aspect ratio. He ends the post with more details on the contents of the header and what each character means.

tagged: binary data unpack pack tutorial gif image

Link: https://www.codediesel.com/php/unpacking-binary-data/

NetTuts.com:
The 11 Phases of a Web Developer’s Career (As Illustrated by Memes)
Mar 25, 2013 @ 14:45:32

NetTuts.com has started off the week on a humorous note with this latest post showing the "11 Phases of a Web Developer's Career" as illustrated with animated GIFs of various internet memes.

The career of a web developer is an interesting one with many slopes. Considering a learning curve this steep, you can fully expect to live through periods of frustration, enlightenment, self-righteousness, and every mindset in between. In this article, we’ll have some fun, by reviewing each of these phases through the lens of a meme!

Some of the phases include:

  • Phase 1 - Noob
  • Phase 3 – Complete Frustration
  • Phase 5 – Fragile Code
  • Phase 7 – Cocky
  • Phase 9 – When Code Becomes Art
  • Phase 10 – Seasoned

Check out the post for the images of these and the others on their "top 11" list.

tagged: webdeveloper career stages animated gif meme humor

Link:

Sameer Borate's Blog:
Unpacking binary data in PHP
Sep 22, 2010 @ 15: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.

tagged: unpack binary data tutorial gif image

Link:

Lorenzo Alberton's Blog:
Create a video preview as animated GIF with FFmpeg and PHP SPL
Sep 04, 2009 @ 14:52:50

Lorenzo Alberton has posted a new item to his blog with a code snippet showing the combination of FFmpeg and features in PHP's SPL to make a GIF preview.

About one year ago, I had to create animated GIFs as a preview of a video for a media portal. I recently stumbled upon the code I wrote and thought it was probably worth sharing. It makes a rather unconventional use of the SPL Iterators, proving how flexible they are.

His method combines Imagick, FFmpeg and a a Thumbnail_Extractor class that extends the SPL Iterator. The script runs through the frames of the movie file and allows you to define multiple places to pull thumbnails from. Complete code and output examples are included.

tagged: animated gif tutorial ffmpeg movie thumbnail spl

Link:

Mikko Koppanen:
Requested examples: Animating GIF Images
Oct 10, 2007 @ 14:32:00

At the request of another developer, Mikko Koppanen has written up a post for his blog today showing how to create animated GIFs in PHP with Imagick.

Today's example was requested by a user called Devo. This example illustrates making an animated GIF image by creating the frames from scratch. It's been so long since I've really drawn anything so I decided to use text as the base for this animation.

His example ends up as a string ("Hello World") that's animated to show one more letter at a time as each frame loads.

tagged: imagick animated gif image text hellowworld imagick animated gif image text hellowworld

Link:

Mikko Koppanen:
Requested examples: Animating GIF Images
Oct 10, 2007 @ 14:32:00

At the request of another developer, Mikko Koppanen has written up a post for his blog today showing how to create animated GIFs in PHP with Imagick.

Today's example was requested by a user called Devo. This example illustrates making an animated GIF image by creating the frames from scratch. It's been so long since I've really drawn anything so I decided to use text as the base for this animation.

His example ends up as a string ("Hello World") that's animated to show one more letter at a time as each frame loads.

tagged: imagick animated gif image text hellowworld imagick animated gif image text hellowworld

Link:

DevShed:
Creating Image Streams from Existing Graphics with the GD Library in PHP
Aug 20, 2007 @ 16: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).

tagged: tutorial gd graphic create stream png jpg gif existing tutorial gd graphic create stream png jpg gif existing

Link:

DevShed:
Creating Image Streams from Existing Graphics with the GD Library in PHP
Aug 20, 2007 @ 16: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).

tagged: tutorial gd graphic create stream png jpg gif existing tutorial gd graphic create stream png jpg gif existing

Link:

Builder.com.au:
PHP exploit code plants itself in GIF
Jun 22, 2007 @ 17: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.

tagged: gif exploit image script embed gif exploit image script embed

Link:

Builder.com.au:
PHP exploit code plants itself in GIF
Jun 22, 2007 @ 17: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.

tagged: gif exploit image script embed gif exploit image script embed

Link:


Trending Topics: