Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp directory overflow issue #1321

Merged
merged 3 commits into from Feb 18, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 12 additions & 5 deletions lib/carrierwave/processing/mini_magick.rb
Expand Up @@ -258,12 +258,19 @@ def resize_and_pad(width, height, background=:transparent, gravity='Center')
def manipulate! def manipulate!
cache_stored_file! if !cached? cache_stored_file! if !cached?
image = ::MiniMagick::Image.open(current_path) image = ::MiniMagick::Image.open(current_path)
image.format(@format.to_s.downcase) if @format
image = yield(image) begin
image.write(current_path) image.format(@format.to_s.downcase) if @format
::MiniMagick::Image.open(current_path) image = yield(image)
image.write(current_path)
image.run_command("identify", current_path)
ensure
image.destroy!
end
rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e
raise CarrierWave::ProcessingError, I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :default => I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :locale => :en)) default = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :locale => :en)
message = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :default => default)
raise CarrierWave::ProcessingError, message
end end


end # MiniMagick end # MiniMagick
Expand Down