Skip to content

Jekyll tag that renders base64 codes of images fetched from the web

Notifications You must be signed in to change notification settings

GSI/jekyll_image_encode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Jekyll Image Encode

This Jekyll plugin fetches images from the web and renders their corresponding base64 codes.

For example, a 1×1 clear PNG would become:

<img src="data:image;base64, iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAxJREFUCNdj+P//PwAF/gL+3MxZ5wAAAABJRU5ErkJggg== " />

Be sure to know your reasons when using this plugin.

Installation

Set the constant PATH_TO_JEKYLL_SITE correctly and run these commands accordingly:

cd ${PATH_TO_JEKYLL_SITE}
echo "gem 'jekyll_image_encode'" >> Gemfile
bundle
echo "require 'jekyll_image_encode'" >> _plugins/ext.rb

Alternatively you may accomplish the same without echo and bundle:

  1. Install the plugin by running gem install jekyll_image_encode
  2. Add the line require 'jekyll_image_encode' to _plugins/ext.rb

Usage

In the source attribute of an HTML img element, call the base64-tag providing the image URL as the only parameter:

<img src="{% base64 http://example.org/image.png %}" />

This works for both remote (http://…) and local urls within your jekyll project.

License

Jekyll Image Embed is released under the MIT License.

About

Jekyll tag that renders base64 codes of images fetched from the web

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages