2

I am using windows 10 to program ruby on rails 6 with the help of ruby installer. Everything works fine so far until... I use action text for rich text editor.

I followed this guide [https://edgeguides.rubyonrails.org/action_text_overview.html][1] and everything works. But when I attach an image to the text_area, after saving the image cannot be displayed.

When I open the image's url, I see this:

MiniMagick::Error in ActiveStorage::RepresentationsController#show

`magick mogrify -resize-to-limit [1024, 768] C:/Users/.../AppData/Local/Temp/ActiveStorage-5-20200716-3792-28u8ot.jpg` failed with error: mogrify: unrecognized option `-resize-to-limit' @ error/mogrify.c/MogrifyImageCommand/6009.


  if status != 0 && options.fetch(:whiny, MiniMagick.whiny)
    fail MiniMagick::Error, "`#{command.join(" ")}` failed with error:\n#{stderr}"
  end

Model: Product

  • title
  • description(action text - attach image in text_area)

Display in view: product.description ( attached image cannot be displayed )

Can anyone help me solve this problem?

akasuki101
  • 51
  • 1
  • 4
  • You need to install `image-magick`. Follow the instruction at https://tektriks.com/a-step-by-step-guide-on-how-to-install-imagemagick-in-windows/ – Chakreshwar Sharma Jul 16 '20 at 13:19
  • @ChakreshwarSharma I already installed `Version: ImageMagick 7.0.10-23 Q16 x64 2020-07-04` – akasuki101 Jul 16 '20 at 13:34
  • How you are displaying the image(code) & have you installed gem `image-processing`?, Paste you model and view code – Chakreshwar Sharma Jul 16 '20 at 14:11
  • @ChakreshwarSharma Haha, thank you! I forgot install image-processing gem, it was the cause of my problem. I've just installed it and now everything is working! – akasuki101 Jul 16 '20 at 14:29

1 Answers1

2

Add gem 'image-processing' to your Gemfile and

run bundle install

Chakreshwar Sharma
  • 2,571
  • 1
  • 11
  • 35