Search code examples
ruby-on-railsminimagickrails-activestorage

Rails 5 with Active Storage causing minimagick::invalid error with message improper image header


After upgrading to rails 5 with Active Storage, I'm having this error for each upload.

Failure/Error: self.image.variant(resize: large_size).processed
 MiniMagick::Invalid:
   `identify /var/folders/9f/llmvc73n031_s_hn2fqg1czh0000gn/T/mini_magick20180706-88409-k0z76z.png` failed with error:
   identify: improper image header `/var/folders/9f/llmvc73n031_s_hn2fqg1czh0000gn/T/mini_magick20180706-88409-k0z76z.png' @ error/png.c/ReadPNGImage/4229

This is my gemfile.

gem 'rails', '~> 5.2.0'

gem 'execjs' 
gem 'therubyracer'

#gem 'mini_magick'
gem 'image_processing', '~> 1.2'

Does anyone experience this?


Solution

  • Actually the problem was something else. I was trying to solve this Rails 5 ActiveStorage How to wait for all threads to finish. And I thought it's something related to ActiveStorage. But actually the answer in the other page is related to the way I code.