carrierwave-processing-dominant_color 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/README.md +18 -5
- data/doc/example-cults3d.gif +0 -0
- data/lib/carrierwave/processing/dominant_color.rb +2 -2
- data/lib/carrierwave/processing/dominant_color/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d29b2b9203e3657950fd1abcb8e0bebb761743f0
|
4
|
+
data.tar.gz: eae2863f22b974b70b0de563ab700d6f5fcaca50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6d2ec8ac4ef2d8cd3bb615d1b9715834729cf3dba973ddee74bf4ce2023a16397fe19a572e42ddcc426b840e0d61b7c94592eb38d3bfb5e34d4b5f0db2da713
|
7
|
+
data.tar.gz: 32607ae66b8885d97808b380f27a7a9ad8832c315496d548a8ebe652e0df87f37eb2e90420aea930b02f6a7d701eccfb2d33c8b14911b0ddccbd3f4d3e10197b
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -23,12 +23,22 @@ $ bundle
|
|
23
23
|
Add the dominant color attribute
|
24
24
|
--------------------------------
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
To store the color, you need an attribute on the Rails model where you attach
|
27
|
+
your uploader. Call it `dominant_color_{uploader}`.
|
28
|
+
|
29
|
+
For example if you have the following model:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
class Article
|
33
|
+
mount_uploader :photo, PhotoUploader
|
34
|
+
end
|
35
|
+
```ruby
|
36
|
+
|
37
|
+
You need to add a `dominant_color_photo` column to the `articles` table. You
|
38
|
+
would then create a migration by executing:
|
29
39
|
|
30
40
|
```sh
|
31
|
-
$ rails g migration AddDominantColorToArticles
|
41
|
+
$ rails g migration AddDominantColorToArticles dominant_color_photo
|
32
42
|
$ rake db:migrate
|
33
43
|
```
|
34
44
|
|
@@ -73,9 +83,12 @@ An easy way of using your dominant colors is to put them as a background to your
|
|
73
83
|
image tags:
|
74
84
|
|
75
85
|
```erb
|
76
|
-
<%= image_tag(article.photo.url(:thumb), style: "background: #{article.
|
86
|
+
<%= image_tag(article.photo.url(:thumb), style: "background: #{article.dominant_color_photo}") %>
|
77
87
|
```
|
78
88
|
|
89
|
+
For example, on [cults3d](http://cults3d.com):
|
90
|
+
|
91
|
+

|
79
92
|
|
80
93
|
Contributing
|
81
94
|
------------
|
Binary file
|
@@ -7,8 +7,8 @@ module CarrierWave
|
|
7
7
|
module Processing
|
8
8
|
module DominantColor
|
9
9
|
def store_dominant_color
|
10
|
-
|
11
|
-
model.
|
10
|
+
colors = Miro::DominantColors.new(current_path).to_hex
|
11
|
+
model.send("dominant_color_#{mounted_as}=", colors.first)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-processing-dominant_color
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sunny Ripert
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- README.md
|
67
67
|
- Rakefile
|
68
68
|
- carrierwave-processing-dominant_color.gemspec
|
69
|
+
- doc/example-cults3d.gif
|
69
70
|
- lib/carrierwave/processing/dominant_color.rb
|
70
71
|
- lib/carrierwave/processing/dominant_color/version.rb
|
71
72
|
homepage: https://github.com/sunny/carrierwave-processing-dominant_color
|