PHP Classes

Image Embedder: Replace images with embedded data in HTML pages

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 476 All time: 5,976 This week: 455Up
Version License PHP version Categories
image-embedder 0.1MIT/X Consortium ...5.0HTML, PHP 5, Graphics


This class can replace images with embedded data in HTML pages.

It can parse HTML documents to locate image tags.

The class can read the images and replace the image tags with URLs that embed the image data in the files, as long the files are not larger than a size limit which is 50K by default.

The original HTML files are renamed and the altered HTML documents are saved back to new files with the same name as the original.

Innovation Award
PHP Programming Innovation award nominee
April 2012
Number 3

Prize: One downloadable copy of Komodo IDE
When you need to send an HTML page to somebody, it may be a complicated process if it uses images or other resources as external files. In that case all the external resources need to be bundled with the main HTML page.

This class implements an alternative solution to avoid needing to bundle external files as separate files.

It replaces all image tags with data URLs that contain the actual image data embedded in the same HTML document, so the images no longer need to be retrieved from separate files.

Manuel Lemos
Picture of Karl Holz
  Performance   Level  
Name: Karl Holz <contact>
Classes: 14 packages by
Country: Canada Canada
Age: 43
All time rank: 44918 in Canada Canada
Week rank: 28 Up2 in Canada Canada Up
Innovation award
Innovation award
Nominee: 9x


  Files folder image Files  
File Role Description
Plain text file img_fixer.php Class shell script/class
Accessible without login Plain text file README.txt Lic. readme & licence
Accessible without login Plain text file site_scanner.php Appl. php cli utility to scan all xhtml/well formed html files in current directory and encode the images under 50k

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:5,976
This week:455Up