[Rails] Beginners can resize images with image_tag (groping)

1. Display the image with form_tag

<li><%= image_tag @post.image.url,size:"180x200" %></li>
Or
<li><%= image_tag @post.image.to_s,size:"180x200" %></li>

The code that can be displayed is ↑. gem installed carrierwave and mini_magick.

2. Failure example

<li><%= image_tag @post.image.url %></li>

If you don't define size, the image size will be huge and the browser will be messed up. Even if I remove the size specification in the erb file and try to resize it with uploader, there is no change. ↓

version :thumb do
    process resize_to_fill: [50, 100]
  end

4. Future issues

By specifying the size directly in the erb file, the error that the format of the browser display itself collapses was solved. However, the image itself has stretched. I was able to confirm that mini_magick was installed, but I can't resize it no matter how I change the uploader file. Discover how to resize in uploader files.

Recommended Posts

[Rails] Beginners can resize images with image_tag (groping)
[Commentary with images] Github beginners summarized gitignore
Upload multiple images easily with rails rails + carrierwave + cloudinary
Rails beginners tried to get started with RSpec
[Ruby on Rails] Upload multiple images with refile
[Must-see for beginners] Compile settings with IntellJ [Many images]
[Ruby on Rails] Delete s3 images with Active Strage