ruby on rails - Convert tiff to png or jpg image -
i trying save image format tiff. getting saved problem tiff format not compatible browser need convert image while saving it. using carrier wave , mini-magick. whenever try save tiff image getting error attachment . translation missing: en.errors.messages.mini_magick_processing_error
attachment uploader
class attachmentuploader < carrierwave::uploader::base include carrierwave::minimagick storage :file version :normal process :mogrify => [{ :resolution => '108x369' }] end def default_url "#{model.class.to_s.underscore.downcase}/#{mounted_as}/missing/" + [version_name, 'missing.png'].compact.join('_') end def extension_white_list %w(jpg jpeg gif png bmp tif tiff) end def filename "#{model.nicely_formatted_filename}.png" end private def mogrify(options = {}) manipulate! |img| img.format("png") |c| c.fuzz "3%" c.trim c.rotate "#{options[:rotate]}" if options.has_key?(:rotate) c.resize "#{options[:resolution]}>" if options.has_key?(:resolution) c.resize "#{options[:resolution]}<" if options.has_key?(:resolution) c.profile.+ "!xmp,*" c.profile "#{rails.root}/lib/color_profiles/srgb_v4_icc_preference_displayclass.icc" c.colorspace "srgb" end img end end end
log
activerecord::schemamigration load (0.3ms) select `schema_migrations`.* `schema_migrations` processing resumescontroller#create html parameters: {"utf8"=>"✓", "authenticity_token"=>"stirkps7rf8ahuvahlrw/06tl+psjaxxzmffiuja5meminq1pzf0ezxje1r66vc9ele64judc+anvzyb1r4wgq==", "resume"=>{"name"=>"asas", "attachment"=>#<actiondispatch::http::uploadedfile:0x00000002c509e8 @tempfile=#<tempfile:/tmp/rackmultipart20170912-27107-9zr3ju.tiff>, @original_filename="relayoutputmessagesmall.tiff", @content_type="image/tiff", @headers="content-disposition: form-data; name=\"resume[attachment]\"; filename=\"relayoutputmessagesmall.tiff\"\r\ncontent-type: image/tiff\r\n">}, "commit"=>"save"} (0.1ms) begin (0.1ms) rollback rendered resumes/new.html.erb within layouts/application (12.1ms) completed 200 ok in 354ms (views: 275.1ms | activerecord: 1.1ms)
Comments
Post a Comment