jitterbug 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +38 -7
- data/VERSION +1 -1
- data/jitterbug.gemspec +1 -1
- data/lib/jitterbug.rb +3 -3
- metadata +1 -1
data/README.markdown
CHANGED
@@ -1,19 +1,50 @@
|
|
1
1
|
# Jitterbug: A just-in-time image creator for pretty text headers
|
2
2
|
|
3
|
-
Jitterbug provides on-demand text header images using the font of your choice. On
|
3
|
+
Jitterbug provides on-demand text header images using the font of your choice. On the first request, Jitterbug creates the requested header graphic and returns its image tag. On subsequent requests it returns the image tag of the already-created graphic.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Pass the `jitterbug` helper a string to convert into a header graphic. Optionally pass in any other parameters that differ from the defaults.
|
8
|
+
|
9
|
+
<%= jitterbug 'Default' %>
|
10
|
+
<%= jitterbug('Forty Two', :size => 42) %>
|
11
|
+
<%= jitterbug(t('whole_enchilada'), :background => '#fff', :color => 'green', :font => 'Yummy.otf', :font_dir => '/fonts/', :format => 'gif', :img_path => '/images/headers/', :size => 64, :width => 240) %>
|
12
|
+
|
13
|
+
## Dependencies
|
14
|
+
|
15
|
+
Jitterbug uses `Imagemagick` to build the header images. It needs to be installed on your development and production machines, as do any fonts that you're using.
|
4
16
|
|
5
17
|
## Quick Links
|
6
18
|
|
7
|
-
* http://github.com/flyingsaucer/jitterbug
|
19
|
+
* [github.com/flyingsaucer/jitterbug](http://github.com/flyingsaucer/jitterbug)
|
20
|
+
* [imagemagick.org](http://www.imagemagick.org/script/index.php)
|
8
21
|
|
9
|
-
##
|
22
|
+
## Installation
|
10
23
|
|
11
|
-
# Install the gem:
|
12
24
|
sudo gem install jitterbug
|
13
|
-
|
14
|
-
## Using in an existing project
|
15
25
|
|
26
|
+
In your `config/environment.rb` file:
|
27
|
+
|
28
|
+
Rails::Initializer.run do |config|
|
29
|
+
config.gem "jitterbug", :source => 'http://gemcutter.org/'
|
30
|
+
end
|
31
|
+
|
32
|
+
## Configuration
|
33
|
+
|
34
|
+
Define your global configuration in `config/jitterbug.yml`. The following sample contains Jitterbug's built in defaults. Note that the asterisk default for the font causes Jitterbug to use the first font that it finds in the font_dir folder.
|
16
35
|
|
36
|
+
development: &defaults
|
37
|
+
background: transparent
|
38
|
+
color: white
|
39
|
+
font: *
|
40
|
+
font_dir: /lib/fonts/
|
41
|
+
format: png
|
42
|
+
img_path: /content/jitterbug/
|
43
|
+
size: 14
|
17
44
|
|
18
|
-
|
45
|
+
test:
|
46
|
+
<<: *defaults
|
47
|
+
img_path: /tmp/jitterbug/
|
19
48
|
|
49
|
+
production:
|
50
|
+
<<: *defaults
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/jitterbug.gemspec
CHANGED
data/lib/jitterbug.rb
CHANGED
@@ -19,9 +19,9 @@ module Jitterbug
|
|
19
19
|
-font #{Jitterbug::Fonts.find(options[:font_dir], options[:font])} \
|
20
20
|
-pointsize #{options[:size]} -blur 0x.3 #{caption} #{path}`
|
21
21
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
img_src = "/#{options[:img_path]}/#{hash}.#{options[:format]}".gsub('//', '/')
|
23
|
+
img_class = (['jitterbug'] << options[:class]).compact.join(' ')
|
24
|
+
%Q{<img src="#{img_src}" class="#{img_class}" alt="#{label}" />}
|
25
25
|
end
|
26
26
|
|
27
27
|
end
|