Convert images to HTML tables using GD, great for email templates.
Click the image above to view the demo.
This is an experimental project created to try and overcome the issue of loading images into email templates by replacing them using a table. This project works great with small icons and graphics, it's not recommended for larger images.
- PHP 5+
- GD Library
Using the thumbnail of Brad Pitt me above which is 6KB as a JPEG image is turned into a 271KB HTML file once rendered. The size difference is substantial and ImageTable has been optimized to output the smallest filesize based on tests. If you can contribute a more efficient output then please PR!
This simple class can turn any PNG, JPG or JPEG into a valid HTML table. Heres an example of how to use ImageTable.
<?php
require './ImageTable.php';
$image_file = 'image.png';
$it = new jakerb\ImageTable($image_file);
?>
$it->renderTable();
$it->renderTable('image-table.html');
That's it! Star this project if you've found it useful!