We've moved discussions to Discord

Unable to upload/view avatar in production

Tom Iwaniec
I've installed ImageMagick (Version: ImageMagick 7.0.10-14 Q16 x86_64 ) on the Ubuntu 18.0.4 server. But when uploading avatars through the built in function they don't appear, and when attempting to view the actual image URL in the browser I get a rails failure (I've enabled config.consider_all_requests_local = true for now). The same thing happens with any uploaded image that is any format.


MiniMagick::Error in ActiveStorage::RepresentationsController#show

`magick convert /tmp/ActiveStorage-5-20200528-1390-1v6qc9e.png[0] -auto-orient -thumbnail 48x48^ -gravity center -extent 48x48 /tmp/image_processing20200528-1390-5s4002.png` failed with error: convert: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/562. convert: no images defined `/tmp/image_processing20200528-1390-5s4002.png' @ error/convert.c/ConvertImageCommand/3282. Extracted source (around line #17): 15 16 17 18 19 20 | if status != 0 && options.fetch(:whiny, MiniMagick.whiny) fail MiniMagick::Error, "`#{command.join(" ")}` failed with error:\n#{stderr}" end $stderr.print(stderr) unless options[:stderr] == false mini_magick (4.10.1) lib/mini_magick/shell.rb:17:in `run' mini_magick (4.10.1) lib/mini_magick/tool.rb:90:in `call' image_processing (1.11.0) lib/image_processing/mini_magick.rb:56:in `save_image' image_processing (1.11.0) lib/image_processing/processor.rb:23:in `call' image_processing (1.11.0) lib/image_processing/pipeline.rb:50:in `call_processor' image_processing (1.11.0) lib/image_processing/pipeline.rb:28:in `block in call' image_processing (1.11.0) lib/image_processing/pipeline.rb:64:in `create_tempfile' image_processing (1.11.0) lib/image_processing/pipeline.rb:27:in `call' image_processing (1.11.0) lib/image_processing/builder.rb:13:in `call!' image_processing (1.11.0) lib/image_processing/chainable.rb:65:in `call' activestorage (6.0.3.1) lib/active_storage/transformers/image_processing_transformer.rb:15:in `process' activestorage (6.0.3.1) lib/active_storage/transformers/transformer.rb:25:in `transform' activestorage (6.0.3.1) app/models/active_storage/variation.rb:52:in `block in transform' activesupport (6.0.3.1) lib/active_support/notifications.rb:182:in `instrument' activestorage (6.0.3.1) app/models/active_storage/variation.rb:51:in `transform' activestorage (6.0.3.1) app/models/active_storage/variant.rb:105:in `transform' activestorage (6.0.3.1) app/models/active_storage/variant.rb:100:in `block in process' activestorage (6.0.3.1) lib/active_storage/downloader.rb:15:in `block in open' activestorage (6.0.3.1) lib/active_storage/downloader.rb:24:in `open_tempfile' activestorage (6.0.3.1) lib/active_storage/downloader.rb:12:in `open' activestorage (6.0.3.1) lib/active_storage/service.rb:86:in `open' activestorage (6.0.3.1) app/models/active_storage/blob.rb:219:in `open' activestorage (6.0.3.1) app/models/active_storage/variant.rb:99:in `process' activestorage (6.0.3.1) app/models/active_storage/variant.rb:67:in `processed' activestorage (6.0.3.1) app/controllers/active_storage/representations_controller.rb:12:in `show' actionpack (6.0.3.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action' actionpack (6.0.3.1) lib/abstract_controller/base.rb:195:in `process_action' actionpack (6.0.3.1) lib/action_controller/metal/rendering.rb:30:in `process_action' actionpack (6.0.3.1) lib/abstract_controller/callbacks.rb:42:in `block in process_action' activesupport (6.0.3.1) lib/active_support/callbacks.rb:135:in `run_callbacks' actionpack (6.0.3.1) lib/abstract_controller/callbacks.rb:41:in `process_action' actionpack (6.0.3.1) lib/action_controller/metal/rescue.rb:22:in `process_action' actionpack (6.0.3.1) lib/action_controller/metal/instrumentation.rb:33:in `block in process_action' activesupport (6.0.3.1) lib/active_support/notifications.rb:180:in `block in instrument' activesupport (6.0.3.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument' activesupport (6.0.3.1) lib/active_support/notifications.rb:180:in `instrument' actionpack (6.0.3.1) lib/action_controller/metal/instrumentation.rb:32:in `process_action' actionpack (6.0.3.1) lib/action_controller/metal/params_wrapper.rb:245:in `process_action' activerecord (6.0.3.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action' actionpack (6.0.3.1) lib/abstract_controller/base.rb:136:in `process' actionview (6.0.3.1) lib/action_view/rendering.rb:39:in `process' actionpack (6.0.3.1) lib/action_controller/metal.rb:190:in `dispatch' actionpack (6.0.3.1) lib/action_controller/metal.rb:254:in `dispatch' actionpack (6.0.3.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch' actionpack (6.0.3.1) lib/action_dispatch/routing/route_set.rb:33:in `serve' actionpack (6.0.3.1) lib/action_dispatch/journey/router.rb:49:in `block in serve' actionpack (6.0.3.1) lib/action_dispatch/journey/router.rb:32:in `each' actionpack (6.0.3.1) lib/action_dispatch/journey/router.rb:32:in `serve' actionpack (6.0.3.1) lib/action_dispatch/routing/route_set.rb:834:in `call' warden (1.2.8) lib/warden/manager.rb:36:in `block in call' warden (1.2.8) lib/warden/manager.rb:34:in `catch' warden (1.2.8) lib/warden/manager.rb:34:in `call' rack (2.2.2) lib/rack/tempfile_reaper.rb:15:in `call' rack (2.2.2) lib/rack/etag.rb:27:in `call' rack (2.2.2) lib/rack/conditional_get.rb:27:in `call' rack (2.2.2) lib/rack/head.rb:12:in `call' actionpack (6.0.3.1) lib/action_dispatch/http/content_security_policy.rb:18:in `call' rack (2.2.2) lib/rack/session/abstract/id.rb:266:in `context' rack (2.2.2) lib/rack/session/abstract/id.rb:260:in `call' actionpack (6.0.3.1) lib/action_dispatch/middleware/cookies.rb:648:in `call' actionpack (6.0.3.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call' activesupport (6.0.3.1) lib/active_support/callbacks.rb:101:in `run_callbacks' actionpack (6.0.3.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call' actionpack (6.0.3.1) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call' actionpack (6.0.3.1) lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call' actionpack (6.0.3.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call' turbolinks_render (0.9.20) lib/turbolinks_render/middleware.rb:81:in `call' railties (6.0.3.1) lib/rails/rack/logger.rb:37:in `call_app' railties (6.0.3.1) lib/rails/rack/logger.rb:26:in `block in call' activesupport (6.0.3.1) lib/active_support/tagged_logging.rb:80:in `block in tagged' activesupport (6.0.3.1) lib/active_support/tagged_logging.rb:28:in `tagged' activesupport (6.0.3.1) lib/active_support/tagged_logging.rb:80:in `tagged' railties (6.0.3.1) lib/rails/rack/logger.rb:26:in `call' actionpack (6.0.3.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call' request_store (1.5.0) lib/request_store/middleware.rb:19:in `call' actionpack (6.0.3.1) lib/action_dispatch/middleware/request_id.rb:27:in `call' rack (2.2.2) lib/rack/method_override.rb:24:in `call' rack (2.2.2) lib/rack/runtime.rb:22:in `call' activesupport (6.0.3.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call' actionpack (6.0.3.1) lib/action_dispatch/middleware/executor.rb:14:in `call' rack (2.2.2) lib/rack/sendfile.rb:110:in `call' actionpack (6.0.3.1) lib/action_dispatch/middleware/host_authorization.rb:76:in `call' railties (6.0.3.1) lib/rails/engine.rb:527:in `call' /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request' /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_request' /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop' /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads' /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'




Chris Oliver
Looks like you've got an issue with your ImageMagick setup on the server.

convert: no decode delegate for this image format `PNG'

Guessing that the version you have installed doesn't support PNG maybe?
Andrew Quinn
Did you ever figure this out? I'm getting the same error on Ubuntu on digitalocean. Works fine locally. 

I've uninstalled and reinstalled the same imagemagick. Running:

convert -list format

does not list PNG as a support option. libpng is installed, so I'm at a loss of what to try next.


Chris Oliver
You might have to compile imagemagick from source to add png support.

You might try using libvips instead. It's pretty great and works seamlessly with image_processing gem. I haven't had a problem using it instead.
Tom Iwaniec
I got it working on a separate droplet. The first droplet was for a test app so I never pursued fixing this, but on it I compiled imagemagick from source. The second droplet I installed via a package manager and it works without issue. Might be worth reinstalling.
Andrew Quinn
Thanks to you both. I has originally run the compile imagemagick from source script on hatchbox. So removing it with apt did nothing. 

I ended up blowing the server out and creating a new droplet without running the script and it worked fine out of the box. My hunch is it's probably some paths that weren't set, but I've got it working now.

Leaving this here incase anyone else comes across it.
Jamie Crone
Thanks! I had spent the last 3 hours trying to figure this out.  I had to reinstall ImageMagick on my server.
Notifications
You’re not receiving notifications from this thread.