httpthumbnailer 0.0.6 → 0.0.7

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 CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
@@ -162,7 +162,7 @@ Feature: Generating set of thumbnails with single PUT request
162
162
  And second part content type will be text/plain
163
163
  And second part body will be CRLF endend lines like
164
164
  """
165
- Error: Magick::ImageMagickError: cache resources exhausted
165
+ Error: Thumbnailer::ImageTooLargeError: Magick::ImageMagickError: cache resources exhausted
166
166
  """
167
167
  Then third part will contain JPEG image of size 16x32
168
168
  And third part mime type will be image/jpeg
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "httpthumbnailer"
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jakub Pastuszek"]
@@ -99,12 +99,17 @@ class Thumbnailer
99
99
  end
100
100
 
101
101
  def thumbnail(spec)
102
- ImageHandler.new do
103
- process_image(@image, spec).render_on_background!((spec.options['background-color'] or 'white').sub(/^0x/, '#'))
104
- end.use do |thumb|
105
- thumb.to_blob do |inf|
106
- inf.format = spec.format
102
+ begin
103
+ ImageHandler.new do
104
+ process_image(@image, spec).render_on_background!((spec.options['background-color'] or 'white').sub(/^0x/, '#'))
105
+ end.use do |thumb|
106
+ thumb.to_blob do |inf|
107
+ inf.format = spec.format
108
+ end
107
109
  end
110
+ rescue Magick::ImageMagickError => e
111
+ raise ImageTooLargeError, e if e.message =~ /cache resources exhausted/
112
+ raise
108
113
  end
109
114
  end
110
115
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpthumbnailer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jakub Pastuszek