#835 - Automatic data URI generation

Identifier #835
Issue type Feature request or suggestion
Title Automatic data URI generation
Status Completed
Tags

Type: Performance (custom)

Handling member Chris Graham
Addon core
Description We could quite easily make a symbol that creates data URIs for theme images, instead of URLs. E.g. $IMG_DATA.

This saves on request volume, embedding images directly into the CSS.
Steps to reproduce

Additional information Sample code found online...

// A few settings
$image = 'cricci.jpg';

// Read image path, convert to base64 encoding
$imageData = base64_encode(file_get_contents($image));

// Format the image SRC: data:{mime};base64,{data};
$src = 'data: '.mime_content_type($image).';base64,'.$imageData;

// Echo out a sample image
echo '<img src="',$src,'">';
Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated