fill_murray 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +48 -4
- data/lib/fill_murray/version.rb +1 -1
- data/lib/fill_murray/view_helpers.rb +5 -2
- metadata +4 -4
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# Fill Murray
|
2
2
|
|
3
|
-
|
3
|
+
Fill Murray makes it super simple to add placeholder images of Bill Murray to
|
4
|
+
your Rails projects. It uses the [website](http://www.fillmurray.com/) created
|
5
|
+
by [Dave Cowart](https://twitter.com/davecowart) to serve images.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -10,7 +12,7 @@ Add this line to your application's Gemfile:
|
|
10
12
|
|
11
13
|
And then execute:
|
12
14
|
|
13
|
-
$ bundle
|
15
|
+
$ bundle install
|
14
16
|
|
15
17
|
Or install it yourself as:
|
16
18
|
|
@@ -18,7 +20,49 @@ Or install it yourself as:
|
|
18
20
|
|
19
21
|
## Usage
|
20
22
|
|
21
|
-
|
23
|
+
Fill Murray gives you a view helper to easily add images: `fill_murray`.
|
24
|
+
|
25
|
+
```erb
|
26
|
+
<%= fill_murray %>
|
27
|
+
```
|
28
|
+
|
29
|
+
This will render an image of Bill Murray at a random height and width between
|
30
|
+
`100px` and `1000px`.
|
31
|
+
|
32
|
+
### Parameters
|
33
|
+
|
34
|
+
You can pass dimensions to better control the output image. `width` comes before
|
35
|
+
`height`, like so:
|
36
|
+
|
37
|
+
```erb
|
38
|
+
<%= fill_murray 200, 300 %>
|
39
|
+
```
|
40
|
+
|
41
|
+
Following the dimensions, you can add a block of configuration options,
|
42
|
+
including:
|
43
|
+
|
44
|
+
* `alt` : adds alternate attribute to image tag
|
45
|
+
* `class` : adds class(es) to image tag
|
46
|
+
* `grey` : will make image black and white (accepts `true`/`false`)
|
47
|
+
|
48
|
+
**For example:**
|
49
|
+
|
50
|
+
```erb
|
51
|
+
<%= fill_murray 1200, 300, { :grey => true, :class => "panoramic" } %>
|
52
|
+
```
|
53
|
+
|
54
|
+
> Note: Currently, you must specify `width` and `height` to be able to pass
|
55
|
+
> options.
|
56
|
+
|
57
|
+
## The Future
|
58
|
+
|
59
|
+
This gem is at its beginning and only has limited features and functionality. I
|
60
|
+
plan to expand on this in the future. Here are some planned features:
|
61
|
+
|
62
|
+
* add Nick Cage and Steven Segal images (also sites from Dave Cowart)
|
63
|
+
* add additional (but always fun) placeholder images
|
64
|
+
* make it easier to pass parameters (options without dimensions)
|
65
|
+
* allow dimension ratio as an option for random images
|
22
66
|
|
23
67
|
## Contributing
|
24
68
|
|
data/lib/fill_murray/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module FillMurray
|
2
2
|
module ViewHelpers
|
3
3
|
|
4
|
-
def fill_murray(width, height, options = {})
|
4
|
+
def fill_murray(width = nil, height = nil, options = {})
|
5
5
|
if height.blank?
|
6
6
|
if width.blank?
|
7
7
|
width = Random.new.rand(100...1000)
|
@@ -10,7 +10,10 @@ module FillMurray
|
|
10
10
|
height = width
|
11
11
|
end
|
12
12
|
end
|
13
|
-
|
13
|
+
if options[:grey] == true
|
14
|
+
g = "g/"
|
15
|
+
end
|
16
|
+
image_tag "http://www.fillmurray.com/#{g}#{width}/#{height}",
|
14
17
|
:alt => options[:alt] ? options[:alt] : nil,
|
15
18
|
:class => options[:class] ? options[:class] : nil
|
16
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fill_murray
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -76,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
76
|
version: '0'
|
77
77
|
segments:
|
78
78
|
- 0
|
79
|
-
hash: -
|
79
|
+
hash: -2457189183114558637
|
80
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
version: '0'
|
86
86
|
segments:
|
87
87
|
- 0
|
88
|
-
hash: -
|
88
|
+
hash: -2457189183114558637
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
91
|
rubygems_version: 1.8.23
|