emrekutlu / paperclip-compression Goto Github PK
View Code? Open in Web Editor NEWimage compression processor for Paperclip
License: MIT License
image compression processor for Paperclip
License: MIT License
Good day. If I write
has_attached_file: icon,
styles: {n100: ['100x100', :jpg, quality: 92]}
retina: false,
convert_options: { all: '-background white-flatten + matte'},
processors: [:thumbnail, :compression]
And upload the image as a png, the plugin will try to do
PaperclipCompression :: Png.make (@file, @options)
But I have to optimize jpg.
I change file paperclip-compression-0.3.1/lib/paperclip-compression/paperclip/compression.rb
...
def make
case @attachment.content_type
when 'image/jpeg' then make_jpeg
when 'image/png' then make_png
else
@file
end
end
...
to
...
def make
case @options[:format]
when :jpg then make_jpeg
when :png then make_png
else
@file
end
end
...
and it work to me.
Is it a good idea to replace Guetzli?
Paperclip compression doesn't work on Alpine Linux because of the vendorized binaries. Is there a setting to force this gem to use native OS installed binaries instead?
I have incorporate paperclip-compression in a very simple way, requested that just JPGs get compressed. Configuration as follows:
has_attached_file :image, processors: [ :rotator, :compression ],
styles: {
large: {
geometry: "1000x1000>",
processor_options: {
compression: {
png: false,
jpeg: '-copy none -optimize',
},
},
},
However, when I reprocess my existing paperclip assets in the rails console, paperclip-compression is saving the file as a .png file. Note the last line in the output below:
Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/d8862f378121712d2600d85f8cf389d620171217-21995-wlrhbw.jpg[0]' 2>/dev/null
Command :: identify -format %m '/tmp/d8862f378121712d2600d85f8cf389d620171217-21995-wlrhbw.jpg[0]'
Command :: convert '/tmp/d8862f378121712d2600d85f8cf389d620171217-21995-wlrhbw.jpg[0]' -auto-orient -resize "300x300>" -quality 85 '/tmp/e51f0c2fffc1d5330fc0279a446e15ce20171217-21995-620q7x'
Command :: /home/andrew/.rvm/gems/ruby-2.4.0/gems/paperclip-compression-1.0.0/bin/linux/x64/jpegtran -copy none -optimize '/tmp/e51f0c2fffc1d5330fc0279a446e15ce20171217-21995-620q7x' > '/tmp/8321bf781908b3041b4a52e67447e78f20171217-21995-ocqwtu.png'
Thoughts as to why this is happening and how to fix it?
Since paperclip has been deprecated, a new maintainer has stepped forward with their own version of paperclip. Would it be possible to change the gemspec to reference the new gem? If not in master, maybe have a kt-paperclip
branch?
Hi,
With 'paperclip-compression' in my Gemfile the rails app won't boot.
I get the following error when starting the web server
$ rails s
.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/parser-2.1.7/lib/parser/ruby21.rb:13:in `<top (required)>': undefined method `check_for_encoding_support' for Parser:Module (NoMethodError)
Is there an easy way to regenerate old images? We have for the moment 300.000 images hosted on our website and we want to optimize all this images. Is there a rake task that we can run so he will optimize the images and overwrite the old images?
All our images are stored on s3.
Add license to gemspec.
After enabling paperclip-compression for attached files on my OSX machine I can see a reduction in file size with the default settings. However, when I deploy this to EC2, which is running Ubuntu 12.04, I don't see any effect.
What am I missing?
I see a lot of noise in test output, I think it's mainly optipng. What are thoughts on defining OPTIPNG_DEFAULT_OPTS in png.rb to include a -q for quiet output?
When run on MacOS Catalina 10.15.7, I receive an "undefined method '[]' for nil:NilClass"
Investigating further, I found the cause on Lines 77-80 of base.rb
def catalina?
major = OS.host_os.match(/darwin(\d+)\./)[1].to_i
major >= 19
end
OS.host_os on my Mac returns 'darwin19'
It appears that the match is failing, returning nil, causing the [1] to raise an exception.
Same is true with kt-paperclip-compression
When I try something like this:
MyModel.create!(:icon => File.open(File.join(Rails.root,"app/assets/images/icons/my_image_name.png")))
I got the following error:
undefined method `seek' for Paperclip::FileAdapter: my_image_name.png:Paperclip::FileAdapter
/Users/oscar/.rvm/gems/ruruby-imagespec-0.3.1/lib/parser/png.rb:19:in `dimensions'
/Users/oscar/.rvm/gems/ruruby-imagespec-0.3.1/lib/parser/png.rb:9:in `attributes'
/Users/oscar/.rvm/gems/ruruby-imagespec-0.3.1/lib/parser.rb:14:in `block in parse'
/Users/oscar/.rvm/gems/ruruby-imagespec-0.3.1/lib/parser.rb:13:in `each'
/Users/oscar/.rvm/gems/ruruby-imagespec-0.3.1/lib/parser.rb:13:in `parse'
/Users/oscar/.rvm/gems/ruruby-imagespec-0.3.1/lib/image_spec.rb:7:in `initialize'
/Users/oscar/.rvm/gems/rupaperclip-compression-0.3.3/lib/paperclip-compression/paperclip/compression.rb:25:in `new'
The current code is checking only if the @file
is a Paperclip::UploadedFileAdapter
:
Image compression fails on macOS 10.15 - Catalina.
Error message:
Paperclip::Error: JPEGTRAN : There was an error processing f9aaf99b6da6fe2f2c247a8bc707caab20191015-14554-xej91e
Code that triggers the compressor:
has_attached_file :image_file,
styles: { medium: 'x180>', large: 'x400>' },
convert_options: { medium: '-quality 80', large: '-quality 80' },
processors: %i[thumbnail compression],
url: '/upload/:class/:attachment/:id_partition/:style/:filename',
path: ':rails_root/public/upload/:class/:attachment/:id_partition/:style/:filename',
default_url: '/home/.../kitteh.jpeg'
I have this error on the production server (FreeBSD) while locally everything works.
So I thought that the compression might not work due to optipng but running it manually on a png file optipng -o 5 file.png
on the server works perfectly fine
TypeError: no implicit conversion of nil into String
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-compression-0.3.6/lib/paperclip-compression/base.rb", line 34, in join
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-compression-0.3.6/lib/paperclip-compression/base.rb", line 34, in command_path
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-compression-0.3.6/lib/paperclip-compression/jpeg.rb", line 21, in make
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-compression-0.3.6/lib/paperclip-compression/base.rb", line 13, in make
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-compression-0.3.6/lib/paperclip-compression/paperclip/compression.rb", line 17, in make_jpeg
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-compression-0.3.6/lib/paperclip-compression/paperclip/compression.rb", line 7, in make
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/processor.rb", line 33, in make
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/attachment.rb", line 522, in block in post_process_style
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/attachment.rb", line 521, in each
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/attachment.rb", line 521, in inject
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/attachment.rb", line 521, in post_process_style
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/attachment.rb", line 512, in block in post_process_styles
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/attachment.rb", line 511, in each
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/attachment.rb", line 511, in post_process_styles
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/attachment.rb", line 503, in block (2 levels) in post_process
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 425, in _run__2992332529639714429__logo_post_process__2532431087528189716__callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 405, in __run_callback
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 385, in _run_logo_post_process_callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 81, in run_callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/callbacks.rb", line 36, in run_paperclip_callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/attachment.rb", line 501, in block in post_process
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 403, in _run__2992332529639714429__post_process__2532431087528189716__callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 405, in __run_callback
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 385, in _run_post_process_callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 81, in run_callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/callbacks.rb", line 36, in run_paperclip_callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/attachment.rb", line 500, in post_process
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/attachment.rb", line 456, in post_process_file
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/attachment.rb", line 108, in assign
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/paperclip-4.2.1/lib/paperclip/has_attached_file.rb", line 66, in block in define_setter
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activerecord-3.2.21/lib/active_record/attribute_assignment.rb", line 85, in block in assign_attributes
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activerecord-3.2.21/lib/active_record/attribute_assignment.rb", line 78, in each
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activerecord-3.2.21/lib/active_record/attribute_assignment.rb", line 78, in assign_attributes
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activerecord-3.2.21/lib/active_record/persistence.rb", line 216, in block in update_attributes
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activerecord-3.2.21/lib/active_record/transactions.rb", line 313, in block in with_transaction_returning_status
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/database_statements.rb", line 192, in transaction
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activerecord-3.2.21/lib/active_record/transactions.rb", line 208, in transaction
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activerecord-3.2.21/lib/active_record/transactions.rb", line 311, in with_transaction_returning_status
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activerecord-3.2.21/lib/active_record/persistence.rb", line 215, in update_attributes
File "/usr/home/mars/projects/sdj/releases/20150129092044/app/controllers/account/company_controller.rb", line 24, in update_logo
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_controller/metal/implicit_render.rb", line 4, in send_action
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/abstract_controller/base.rb", line 167, in process_action
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_controller/metal/rendering.rb", line 10, in process_action
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/abstract_controller/callbacks.rb", line 18, in block in process_action
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 448, in block in _run__3563959746979386811__process_action__2602670410999237866__callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 215, in block in _conditional_callback_around_842
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/vanity-1.8.3/lib/vanity/frameworks/rails.rb", line 104, in vanity_context_filter
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 214, in _conditional_callback_around_842
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 414, in _run__3563959746979386811__process_action__2602670410999237866__callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 405, in __run_callback
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 385, in _run_process_action_callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 81, in run_callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/abstract_controller/callbacks.rb", line 17, in process_action
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_controller/metal/rescue.rb", line 29, in process_action
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb", line 30, in block in process_action
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/notifications.rb", line 123, in block in instrument
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb", line 20, in instrument
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/notifications.rb", line 123, in instrument
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb", line 29, in process_action
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_controller/metal/params_wrapper.rb", line 207, in process_action
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activerecord-3.2.21/lib/active_record/railties/controller_runtime.rb", line 18, in process_action
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/abstract_controller/base.rb", line 121, in process
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb", line 45, in process
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_controller/metal.rb", line 203, in dispatch
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_controller/metal/rack_delegation.rb", line 14, in dispatch
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_controller/metal.rb", line 246, in block in action
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb", line 73, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb", line 73, in dispatch
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb", line 36, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/journey-1.0.4/lib/journey/router.rb", line 68, in block in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/journey-1.0.4/lib/journey/router.rb", line 56, in each
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/journey-1.0.4/lib/journey/router.rb", line 56, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb", line 608, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/warden-1.2.3/lib/warden/manager.rb", line 35, in block in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/warden-1.2.3/lib/warden/manager.rb", line 34, in catch
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/warden-1.2.3/lib/warden/manager.rb", line 34, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/middleware/best_standards_support.rb", line 17, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-1.4.5/lib/rack/etag.rb", line 23, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-1.4.5/lib/rack/conditionalget.rb", line 35, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/middleware/head.rb", line 14, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/middleware/params_parser.rb", line 21, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/middleware/flash.rb", line 242, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-1.4.5/lib/rack/session/abstract/id.rb", line 210, in context
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-1.4.5/lib/rack/session/abstract/id.rb", line 205, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/middleware/cookies.rb", line 341, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activerecord-3.2.21/lib/active_record/query_cache.rb", line 64, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb", line 479, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/middleware/callbacks.rb", line 28, in block in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 405, in _run__3889086744914438778__call__2532431087528189716__callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 405, in __run_callback
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 385, in _run_call_callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/callbacks.rb", line 81, in run_callbacks
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/middleware/callbacks.rb", line 27, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/middleware/remote_ip.rb", line 31, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rollbar-1.3.1/lib/rollbar/middleware/rails/rollbar.rb", line 24, in block in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rollbar-1.3.1/lib/rollbar.rb", line 747, in scoped
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rollbar-1.3.1/lib/rollbar/middleware/rails/rollbar.rb", line 22, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/middleware/debug_exceptions.rb", line 16, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rollbar-1.3.1/lib/rollbar/middleware/rails/show_exceptions.rb", line 22, in call_with_rollbar
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/middleware/show_exceptions.rb", line 56, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/railties-3.2.21/lib/rails/rack/logger.rb", line 32, in call_app
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/railties-3.2.21/lib/rails/rack/logger.rb", line 16, in block in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/tagged_logging.rb", line 22, in tagged
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/railties-3.2.21/lib/rails/rack/logger.rb", line 16, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/actionpack-3.2.21/lib/action_dispatch/middleware/request_id.rb", line 22, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-1.4.5/lib/rack/methodoverride.rb", line 21, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-1.4.5/lib/rack/runtime.rb", line 17, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/activesupport-3.2.21/lib/active_support/cache/strategy/local_cache.rb", line 72, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-1.4.5/lib/rack/lock.rb", line 15, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-rewrite-1.4.1/lib/rack/rewrite.rb", line 24, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-cache-1.2/lib/rack/cache/context.rb", line 136, in forward
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-cache-1.2/lib/rack/cache/context.rb", line 143, in pass
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-cache-1.2/lib/rack/cache/context.rb", line 155, in invalidate
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-cache-1.2/lib/rack/cache/context.rb", line 71, in call!
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/rack-cache-1.2/lib/rack/cache/context.rb", line 51, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/railties-3.2.21/lib/rails/engine.rb", line 484, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/railties-3.2.21/lib/rails/application.rb", line 231, in call
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/railties-3.2.21/lib/rails/railtie/configurable.rb", line 30, in method_missing
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/unicorn-4.8.3/lib/unicorn/http_server.rb", line 576, in process_client
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/unicorn-4.8.3/lib/unicorn/http_server.rb", line 670, in worker_loop
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/unicorn-4.8.3/lib/unicorn/http_server.rb", line 525, in spawn_missing_workers
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/unicorn-4.8.3/lib/unicorn/http_server.rb", line 140, in start
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/gems/unicorn-4.8.3/bin/unicorn", line 126, in <top (required)>
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/bin/unicorn", line 23, in load
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/bin/unicorn", line 23, in <main>
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/bin/ruby_executable_hooks", line 15, in eval
File "/home/mars/.rvm/gems/ruby-2.1.2@sdj/bin/ruby_executable_hooks", line 15, in <main>
Would using latest version of jpegtran will improve the performance?
I get this error when saving image.
We've discovered that when paperclip-compression compresses png files and swaps the file pointer from the original to the newly compressed version of the file; the newly compressed version of the file has a size of 0
bytes.
However, if you re-open the file (Such as in the jpg compressor), the size
instance method correctly reflects the size of the file.
[26, 35] in /Users/zee/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/paperclip-compression-0.3.14/lib/paperclip-compression/png.rb
26:
27: def process_file
28: Paperclip.run(command_path('optipng'), "#{@cli_opts} -clobber :src_path -out :dst_path", src_path: @src_path, dst_path: @dst_path)
29: require 'byebug'
30: byebug
=> 31: @dst
32: end
33:
34: end
35: end
(byebug) @dst.size
0
(byebug) @dst.open
#<File:/var/folders/sx/s1fjq54x2rl0808_hwt52spr0000gn/T/fd7bc86e8c3159466e78d185b79251bb20160330-27063-qqnz5q.png>
(byebug) @dst.size
21417
This can cause problems with downstream processors (Such as paperclip-meta, which sets the meta attribute for the file size to 0)
I don't know what side effects could occur downstream (For instance, do some processors treat files with a size of 0 differently? Do any depend on this behavior for other reasons?)
Thoughts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.