magick_title 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -2
- data/lib/magick_title/image.rb +2 -2
- data/lib/magick_title/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -21,7 +21,7 @@ As usual, just use the `gem install` command:
|
|
21
21
|
|
22
22
|
Or add magick_title as a gem in your Gemfile:
|
23
23
|
|
24
|
-
gem 'magick_title', '>= 0.1.
|
24
|
+
gem 'magick_title', '>= 0.1.7'
|
25
25
|
|
26
26
|
Then run `bundle install`
|
27
27
|
|
@@ -41,7 +41,7 @@ Using MagickTitle is easy. First, customize your global title styles by setting
|
|
41
41
|
:destination => Proc.new{ File.join MagickTitle.root, "public/system/titles" },
|
42
42
|
:extension => "png",
|
43
43
|
:width => 800,
|
44
|
-
:height => nil,
|
44
|
+
:height => nil, # setting to nil or 0 will trim to minimum height
|
45
45
|
:background_color => '#ffffff',
|
46
46
|
:background_alpha => '00',
|
47
47
|
:color => '#68962c',
|
@@ -108,6 +108,7 @@ The html helper can also be customized:
|
|
108
108
|
|
109
109
|
#=> <h3 id="maaaagick"><img class="custom-title" alt="Hello!" src="/system/titles/hello_f76179c852bb2fa264b8ad2c0c9ceeb9f99dfc0b.png"/></h3>
|
110
110
|
|
111
|
+
|
111
112
|
Combine no-parent with custom attributes:
|
112
113
|
|
113
114
|
MagickTitle.say("Hello!").to_html(:class => "custom-title", :parent => nil)
|
@@ -115,7 +116,12 @@ Combine no-parent with custom attributes:
|
|
115
116
|
#=> <img class="custom-title" alt="Hello!" src="/system/titles/hello_f76179c852bb2fa264b8ad2c0c9ceeb9f99dfc0b.png"/>
|
116
117
|
|
117
118
|
|
119
|
+
To make sure all titles are the same height:
|
120
|
+
|
121
|
+
MagickTitle.say("HELLO!", :height => 50).to_html
|
122
|
+
MagickTitle.say("lowercase j's!", :height => 50).to_html
|
118
123
|
|
124
|
+
|
119
125
|
|
120
126
|
### More to come!
|
121
127
|
|
data/lib/magick_title/image.rb
CHANGED
@@ -110,7 +110,7 @@ module MagickTitle
|
|
110
110
|
def to_html(opts={})
|
111
111
|
opts = { :parent => nil } if opts === false
|
112
112
|
opts = { :parent => opts } if opts.is_a?(String)
|
113
|
-
opts =
|
113
|
+
opts = options[:to_html].merge(:alt => text, :src => url).merge(opts)
|
114
114
|
parent = opts.delete(:parent)
|
115
115
|
tag = %(<img#{hash_to_attributes(opts)}/>)
|
116
116
|
if parent
|
@@ -142,7 +142,7 @@ module MagickTitle
|
|
142
142
|
# builds an imagemagick command based on the supplied options
|
143
143
|
def title_command_string(file="")
|
144
144
|
%(
|
145
|
-
-trim
|
145
|
+
#{'-trim ' unless 0 < options.height.to_i}
|
146
146
|
-antialias
|
147
147
|
-background '#{options.background_color}#{options.background_alpha}'
|
148
148
|
-fill '#{options.color}'
|
data/lib/magick_title/version.rb
CHANGED