Search code examples
ruby-on-railsspree

Can not upload image to Spree app


I try to upload a product image to my Spree app, but i get this error

5errors prohibited this record from being saved:

Attachment Paperclip returned errors for file 'index.jpg' - check ImageMagick installation or image source file.
Attachment Paperclip::Errors::NotIdentifiedByImageMagickError
Attachment Paperclip::Errors::NotIdentifiedByImageMagickError
Attachment Paperclip::Errors::NotIdentifiedByImageMagickError
Attachment Paperclip::Errors::NotIdentifiedByImageMagickError

Should i install a gem, relocate my src image? Whats the problem here


Solution

  • Okay so the problem is pretty complicated and after trying to solve it for about 3 hours i finally got it.

    1. First, you have to remove the convert.exe from your System32 files. We do this, because the Spree app relies on legacy code and when it tries to upload the image the default convert.exe starts, we don't want that.
    2. Second you download and install the dynamic installation from the imagemagick site and you have to be sure to check the legacy support so the convert command gets supported.
    3. I dont know if you have to, but i installed the paperclip gem. You may have to do that for it to work.

    The whole reason this bug happens, is because Windows. So if you are new to this party, dual boot your station or swap to Ubuntu/Mac whatever. Seriously though, when the app tries to upload it uses the convert command, but convert is already a default Windows command so you can't upload the picture properly. So we disable the command and then we replace it with our imagemagick installation. That's it.Also good luck trying to delete the convert.exe from system32, its a weird process, but you can solve it with some google-fu.

    Thanks to Michael for pointing me to right way.