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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d2ccb6df497ab37e99bd6e63f10acdbeaae4d10
4
- data.tar.gz: 8d11f8ed1fc2476895cb590f79826b5efebe69b6
3
+ metadata.gz: d29b2b9203e3657950fd1abcb8e0bebb761743f0
4
+ data.tar.gz: eae2863f22b974b70b0de563ab700d6f5fcaca50
5
5
  SHA512:
6
- metadata.gz: c538f96ef952447bd2fb845d0fcbdd60f98b93a998494adf0c89503cd8fb7a6acd8c59329e00fe2c20f06f1866cc2a9d708622e471a025b15a8a778e8943190d
7
- data.tar.gz: 10808af7bebc568531a2e4b8d9fca7f742268cdbf0c17accc61fb3704a83c1fa434cabb10a6e5dc5d9e76f2bffb373013e1f44cbde4e040b9d52cc81a31835fa
6
+ metadata.gz: c6d2ec8ac4ef2d8cd3bb615d1b9715834729cf3dba973ddee74bf4ce2023a16397fe19a572e42ddcc426b840e0d61b7c94592eb38d3bfb5e34d4b5f0db2da713
7
+ data.tar.gz: 32607ae66b8885d97808b380f27a7a9ad8832c315496d548a8ebe652e0df87f37eb2e90420aea930b02f6a7d701eccfb2d33c8b14911b0ddccbd3f4d3e10197b
data/.gitignore CHANGED
@@ -7,7 +7,6 @@ Gemfile.lock
7
7
  InstalledFiles
8
8
  _yardoc
9
9
  coverage
10
- doc/
11
10
  lib/bundler/man
12
11
  pkg
13
12
  rdoc
data/README.md CHANGED
@@ -23,12 +23,22 @@ $ bundle
23
23
  Add the dominant color attribute
24
24
  --------------------------------
25
25
 
26
- On the Rails model where you attach your uploader, you need a `dominant_color=`
27
- attribute. Create a migration by replacing "Articles" with your table name in the
28
- following command:
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 dominant_color
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.dominant_color}") %>
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
+ ![Cults 3D Animated Screenshot with dominant colors during image load](doc/example-cults3d.gif)
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
- color = Miro::DominantColors.new(current_path)
11
- model.dominant_color = color.to_hex.first
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
@@ -1,7 +1,7 @@
1
1
  module CarrierWave
2
2
  module Processing
3
3
  module DominantColor
4
- VERSION = "1.0.0"
4
+ VERSION = "2.0.0"
5
5
  end
6
6
  end
7
7
  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: 1.0.0
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