Skip to content
This repository was archived by the owner on Sep 27, 2018. It is now read-only.

Commit ca630a5

Browse files
author
lepon01
committed
Update README, remove put
1 parent 3c977eb commit ca630a5

File tree

4 files changed

+31
-46
lines changed

4 files changed

+31
-46
lines changed

README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Jekyll Image Encode
2+
3+
_[is a fork of another project](https://github.com/GSI/jekyll_image_encode)_
4+
5+
This Jekyll plugin fetches images from the web and renders their corresponding base64 codes.
6+
7+
For example, a **1x1 clear PNG** would become:
8+
9+
```html
10+
<img src="data:image;base64, iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAxJREFUCNdj+P//PwAF/gL+3MxZ5wAAAABJRU5ErkJggg== " />
11+
```
12+
13+
Be sure to know your reasons when using this plugin.
14+
15+
## Installation
16+
Dunno.
17+
I don't Ruby.
18+
This is a bodge to allow defaults, and also to grab data from the page
19+
20+
## Usage
21+
22+
This grabs `page.data.avatar`, and if the URL doesn't exist, defaults to `/assets/images/logo.png`, relative to the Jekyll
23+
24+
```xml
25+
<img href="{% base64 data.avatar;/assets/images/logo.png %}" />
26+
```

README.textile

-38
This file was deleted.

jekyll_image_encode.gemspec

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Gem::Specification.new do |s|
2-
s.name = 'jekyll_image_encode'
2+
s.name = 'jekyll_image_base64'
33
s.version = '0.0.4'
4-
s.date = '2014-09-24'
5-
s.summary = "Jekyll Image Encode"
6-
s.description = "Jekyll tag that renders base64 codes of images fetched from the web"
4+
s.date = '2018-09-09'
5+
s.summary = "Jekyll Image Base64"
6+
s.description = "Jekyll tag that converts images from the internet to base64"
77
s.add_runtime_dependency "mimemagic", [">= 0.2.0"]
88
s.authors = ["GSI"]
99
s.email = '[email protected]'
1010
s.files = Dir.glob('lib/**/*') # `git ls-files`.split($/)
11-
s.homepage = 'https://github.com/GSI/' + s.name
11+
s.homepage = 'https://github.com/terminal/jekyll_image_encode'
1212
s.license = 'MIT'
1313
end

lib/jekyll_image_encode.rb

-3
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,16 @@ def render(context)
5959

6060
# If the userlink is HTTP or HTTPS, set the URL to that link
6161
if ['http', 'https'].include?URI.parse(userlink).scheme
62-
puts userlink
6362
url = userlink
6463
end
6564

6665
# Return the Base64 of that URL
6766
fetch(url)
6867
rescue OpenURI::HTTPError => e
6968
# If an error occured, return the default
70-
puts e.message
7169
fetch(@default)
7270
rescue URI::InvalidURIError => e
7371
# If the URI was invalid, return the default
74-
puts e.message
7572
fetch(@default)
7673
end
7774
end

0 commit comments

Comments
 (0)