carrierwave-crop 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ffd4701225ed31cd44ecc10ca63ba345edca3f8
4
- data.tar.gz: d03384b62cf0efe5fdf4269d968f1ddfe9ae30be
3
+ metadata.gz: eade0956164d50cc9e0a5468d2735279816c1a36
4
+ data.tar.gz: fbdd13505721e2269b36a706322f8214c2f3897d
5
5
  SHA512:
6
- metadata.gz: 6a2f655debcdba1371c813da797463e25b6597b8dc9f61a1b7f2c9940774490d683ccd706798f87b9461eb81dded61a8bc1cf3b1e7b5fa0c3686abd49e55b9c7
7
- data.tar.gz: 245afb4af8f922cfe24854742e4aca04072fee87f462d1712a8ccd3c42c6532c2ba60574e9e57946726a6c7160270c6e5650c6c059b44c21d9eb36bfe6ceb4fb
6
+ metadata.gz: 7592c42b07bb74fb05888c062fb71462f139060d19d973b97f2392cb0524e07763da86bdc0321588f5756b939383918994e4862032c7336b2187523d02264ca2
7
+ data.tar.gz: 821961cf39d8b962cddfb6c9e391acd59a259852881eb6ac88ec7f28516b649723025d4286398c2e0283ba31c3b7f689ae8d8ceeef96b54ecb33c5e1ca879e85
@@ -10,9 +10,11 @@
10
10
  * Supports cropping of ONE attachment per model. Can be directly applied on original attachment if no versions exists.
11
11
 
12
12
  process crop: :avatar
13
+
13
14
  * Supports cropping of MULTIPLE versions of one attachment per model.
14
15
  * Updated the cropping coffeescript (created by rails generator) to incorporate the changes in form helpers.
15
16
  * Added `version`, `width` and `height` options to form helpers `cropbox` and `previewbox`.
17
+
16
18
  ##To render a specific version for cropping pass `version` option.
17
19
  <%= f.cropbox :avatar , version: :medium %>
18
20
  <%= f.peviewbox :avatar , version: :medium %> ## Pass the same version as specified in cropbox
@@ -20,7 +22,9 @@
20
22
  ## If you override ONE of width/height you MUST override both, otherwise passed option would be ignored.
21
23
  <%= f.cropbox :avatar, width: 550, height: 600 %>
22
24
  <%= f.previewbox :avatar, width: 200, height: 200 %>
25
+
23
26
  * Added `width` and `height` arguments to proccessor method `crop`.
27
+
24
28
  ## If ONLY "thumb" version is to be cropped
25
29
  version :jumbo do
26
30
  resize_to_limit(600,600)
@@ -40,4 +44,7 @@
40
44
  ## Specify both width and height values otherwise they would be ignored
41
45
  process crop: [:avatar, 600, 600]
42
46
  resize_to_limit(100,100)
43
- end
47
+ end
48
+
49
+ ## CarrierWave-Crop v0.1.1
50
+ * Fixes Issue #1: Colons in html `id` attribute for Namespaced Models
data/README.md CHANGED
@@ -113,53 +113,60 @@ If there are no versions, and original file is to be cropped directly then call
113
113
 
114
114
  **To use `rmagick`, add it in your `Gemfile` as:**
115
115
 
116
- gem 'rmagick', :require => 'RMagick' ## Specify appropriate version, if needed
116
+ gem 'rmagick', :require => 'RMagick' ## Specify appropriate version, if needed
117
117
 
118
118
  Run `bundle`
119
119
 
120
120
  Include it in your CarrierWave Uploader. For example:
121
121
 
122
- class AvatarUploader < CarrierWave::Uploader::Base
123
- include CarrierWave::RMagick
122
+ class AvatarUploader < CarrierWave::Uploader::Base
123
+ include CarrierWave::RMagick
124
124
  ...
125
- end
125
+ end
126
126
 
127
127
  **To use `mini_magick`, add it in your `Gemfile` as:**
128
128
 
129
- gem 'mini_magick' ## Specify appropriate version, if needed
129
+ gem 'mini_magick' ## Specify appropriate version, if needed
130
130
 
131
131
  Run `bundle`
132
132
 
133
133
  Include it in your CarrierWave Uploader. For example:
134
134
 
135
- class AvatarUploader < CarrierWave::Uploader::Base
136
- include CarrierWave::MiniMagick
137
- ...
138
- end
135
+ class AvatarUploader < CarrierWave::Uploader::Base
136
+ include CarrierWave::MiniMagick
137
+ ...
138
+ end
139
139
 
140
140
  3. Supports cropping of ONE attachment per model. Can be directly applied on original attachment if no versions exists.
141
- process crop: :avatar
141
+
142
+ process crop: :avatar
143
+
142
144
  4. Supports cropping of MULTIPLE versions of one attachment per model.
143
145
  5. In form helpers, by default *original image* is rendered. To render a specific version for cropping pass `version` option. For example:
144
- <%= f.cropbox :avatar , version: :medium %>
145
- <%= f.peviewbox :avatar , version: :medium %> ## Pass the same version as specified in cropbox
146
+
147
+ <%= f.cropbox :avatar , version: :medium %>
148
+ <%= f.peviewbox :avatar , version: :medium %> ## Pass the same version as specified in cropbox
149
+
146
150
  6. By default `previewbox` has `100x100` dimensions and `cropbox` defaults to the target geometry for the version.
147
151
  `width` and `height` can be specified for these form helpers. BUT If you override ONE of width/height you MUST override both, otherwise passed option would be ignored.
148
- <%= f.cropbox :avatar, width: 550, height: 600 %>
149
- <%= f.previewbox :avatar, width: 200, height: 200 %>
152
+
153
+ <%= f.cropbox :avatar, width: 550, height: 600 %>
154
+ <%= f.previewbox :avatar, width: 200, height: 200 %>
155
+
150
156
  7. By default, `process crop: :avatar` will create the cropped version based on original image.
151
157
  To resize the image to a particular dimension before cropping, pass two more arguments `width` and `height`.
152
- ## If ONLY "thumb" version is to be cropped
153
- version :jumbo do
154
- resize_to_limit(600,600)
155
- end
156
-
157
- version :thumb do
158
- ## To crop this version based on `jumbo` version, pass width = 600 and height = 600
159
- ## Specify both width and height values otherwise they would be ignored
160
- process crop: [:avatar, 600, 600]
161
- resize_to_limit(100,100)
162
- end
158
+
159
+ ## If ONLY "thumb" version is to be cropped
160
+ version :jumbo do
161
+ resize_to_limit(600,600)
162
+ end
163
+
164
+ version :thumb do
165
+ ## To crop this version based on `jumbo` version, pass width = 600 and height = 600
166
+ ## Specify both width and height values otherwise they would be ignored
167
+ process crop: [:avatar, 600, 600]
168
+ resize_to_limit(100,100)
169
+ end
163
170
 
164
171
  ### Credits and resources
165
172
  * [CarrierWave](https://github.com/carrierwaveuploader/carrierwave)
@@ -6,7 +6,7 @@ require 'carrierwave/crop/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "carrierwave-crop"
8
8
  spec.version = CarrierWave::Crop::VERSION
9
- spec.authors = ["kirtithorat"]
9
+ spec.authors = ["Kirti Thorat"]
10
10
  spec.email = ["kirti.brenz@gmail.com"]
11
11
  spec.summary = %q{CarrierWave extension for cropping images with preview.}
12
12
  spec.description = %q{CarrierWave extension to crop uploaded images using Jcrop plugin.}
@@ -20,7 +20,8 @@ module CarrierWave
20
20
  attachment = attachment.to_sym
21
21
 
22
22
  if(self.object.send(attachment).class.ancestors.include? CarrierWave::Uploader::Base )
23
- model_name = self.object.class.name.downcase
23
+ ## Fixes Issue #1 : Colons in html id attributes with Namespaced Models
24
+ model_name = self.object.class.name.downcase.split("::").last
24
25
  width, height = 100, 100
25
26
  if(opts[:width] && opts[:height])
26
27
  width, height = opts[:width].round, opts[:height].round
@@ -52,8 +53,8 @@ module CarrierWave
52
53
  attachment_instance = self.object.send(attachment)
53
54
 
54
55
  if(attachment_instance.class.ancestors.include? CarrierWave::Uploader::Base )
55
-
56
- model_name = self.object.class.name.downcase
56
+ ## Fixes Issue #1 : Colons in html id attributes with Namespaced Models
57
+ model_name = self.object.class.name.downcase.split("::").last
57
58
  hidden_elements = self.hidden_field(:"#{attachment}_crop_x", id: "#{model_name}_#{attachment}_crop_x")
58
59
  [:crop_y, :crop_w, :crop_h].each do |attribute|
59
60
  hidden_elements << self.hidden_field(:"#{attachment}_#{attribute}", id: "#{model_name}_#{attachment}_#{attribute}")
@@ -58,7 +58,7 @@ module CarrierWave
58
58
 
59
59
  module Uploader
60
60
 
61
- # Perfoems cropping.
61
+ # Performs cropping.
62
62
  #
63
63
  # On original version of attachment
64
64
  # process crop: :avatar
@@ -1,5 +1,5 @@
1
1
  module CarrierWave
2
2
  module Crop
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-crop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
- - kirtithorat
7
+ - Kirti Thorat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-16 00:00:00.000000000 Z
11
+ date: 2014-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails