Code Snippets and More

The format of the source path of CSS, javascript and images may not be external. Using the "data" source type we can embed the element into the HTML document. An example of it:

<img alt="Embeded image" src="data:image/png;base64,iVBORw0KGg<div>oAAAANSUhEUgAAADIA..." />


div.image {

The complication of this method is to get the "base64" encoded content of the object. A simply way to get it is using PHP:

<img alt="Embeded image" src="data:image/jpeg;base64,<?php echo base64_encode(file_get_contents('image.jpg'))?>"/>

Also you can use one of the many online tools for this target.

When you create a HTML document, the structure will not disappear, but what will happen with the external objects?

This is an easy method to secure the content of the objects into the document forever.

Recent comments

© 2014 Copyright by Keyvan Akbary