dynamic_image 0.9.7 → 0.9.8
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.
- data/VERSION +1 -1
- data/app/controllers/images_controller.rb +7 -7
- data/app/models/image.rb +4 -4
- data/dynamic_image.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.8
|
@@ -19,7 +19,7 @@ class ImagesController < ActionController::Base
|
|
19
19
|
return
|
20
20
|
end
|
21
21
|
|
22
|
-
unless image.data
|
22
|
+
unless image.data
|
23
23
|
logger.warn "Image #{image.id} exists, but has no data"
|
24
24
|
render_missing_image and return
|
25
25
|
end
|
@@ -43,16 +43,16 @@ class ImagesController < ActionController::Base
|
|
43
43
|
if image
|
44
44
|
response.headers['Cache-Control'] = nil
|
45
45
|
response.headers['Last-Modified'] = imagedata.created_at.httpdate if imagedata.created_at?
|
46
|
-
send_data(
|
47
|
-
imagedata.data,
|
48
|
-
:filename => image.filename,
|
49
|
-
:type => image.content_type,
|
46
|
+
send_data(
|
47
|
+
imagedata.data,
|
48
|
+
:filename => image.filename,
|
49
|
+
:type => image.content_type,
|
50
50
|
:disposition => 'inline'
|
51
51
|
)
|
52
52
|
end
|
53
53
|
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
protected
|
57
57
|
|
58
58
|
def render_missing_image
|
@@ -75,5 +75,5 @@ class ImagesController < ActionController::Base
|
|
75
75
|
def run_garbage_collection_for_dynamic_image_controller
|
76
76
|
DynamicImage.clean_dirty_memory
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
end
|
data/app/models/image.rb
CHANGED
@@ -3,7 +3,7 @@ class Image < ActiveRecord::Base
|
|
3
3
|
|
4
4
|
binary_storage :data, :sha1_hash
|
5
5
|
|
6
|
-
validates_format_of :content_type,
|
6
|
+
validates_format_of :content_type,
|
7
7
|
:with => /^image/,
|
8
8
|
:message => "you can only upload pictures"
|
9
9
|
|
@@ -21,7 +21,7 @@ class Image < ActiveRecord::Base
|
|
21
21
|
image.crop_start = "0x0"
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
# Create the binary from an image file.
|
26
26
|
def imagefile=(image_file)
|
27
27
|
if image_file.kind_of?(String) && image_file =~ /^(ht|f)tps?:\/\//
|
@@ -42,7 +42,7 @@ class Image < ActiveRecord::Base
|
|
42
42
|
# Check the image data
|
43
43
|
def set_image_data(data)
|
44
44
|
self.data = data
|
45
|
-
if self.data
|
45
|
+
if self.data
|
46
46
|
image = Magick::ImageList.new.from_blob(self.data)
|
47
47
|
size = Vector2d.new(image.columns, image.rows)
|
48
48
|
if DynamicImage.crash_size
|
@@ -177,7 +177,7 @@ class Image < ActiveRecord::Base
|
|
177
177
|
# Decorates to_json with additional attributes
|
178
178
|
def to_json
|
179
179
|
attributes.merge({
|
180
|
-
:original_width => self.original_width,
|
180
|
+
:original_width => self.original_width,
|
181
181
|
:original_height => self.original_height,
|
182
182
|
:crop_width => self.crop_width,
|
183
183
|
:crop_height => self.crop_height,
|
data/dynamic_image.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamic_image
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 43
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 8
|
10
|
+
version: 0.9.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Inge J\xC3\xB8rgensen"
|