Currently, when I set to upload images to S3 using Active Storage in the production environment, the images are not displayed properly and I am in trouble.
However, the image is not displayed, but the image can be posted.
Since I can post images, I thought that there was no problem with the access key and secret key settings, and when I checked the console, the following error occurred. Also, in IAM User, I set a User who has administrator privileges.
Thanks for your understanding.
Corresponding source code
Path 500 under GET https://xxxxxx.com/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--7c84fe0e4db0d5f145bfb6794cf7c30d6f3744a9/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9UY21WemFYcGxYM1J2WDJacGJHeGJCMmxCYVVFPSIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--0ae0535ffe18e342a50208e47825434ab16f3deb/dog-5723334_640.jpg
What I tried
<% if current_user.profile&¤t_user.profile.avatar.attached?%> <% = image_tag current_user.profile.avatar.variant (resize_to_fill: [a, b])%> <% else%> <% = image_tag'xxxx.jpg'%> <% end%>
-First, I tried changing the S3 bucket policy settings, but I noticed that it was not relevant because it was accessed by a user with administrator privileges. Also, since I was able to post the image to s3, I thought that there was no problem with the settings there.
-I found that the path generated by image_tag is not the path to S3, so I tried image_tag ulr_for (...), but it didn't work.
<% if current_user.profile&¤t_user.profile.avatar.attached?%> <% = image_tag url_for (current_user.profile.avatar.variant (resize_to_fill: [a, b]))%> <% else%> <% = image_tag'xxxx.jpg'%> <% end%>
Is it difficult to set up S3 in a production environment? Is it just missing something more basic?
Answer # 1
It was due to S3 settings and linux2 not having ImageMagick!
- ruby - bootstrap image is not displayed
- ruby - the image is displayed as strange characters in rails
- ruby - i want to solve the problem that the image is not displayed when using the variant method
- ruby - the image is not displayed in the product listing function
- ruby on rails - [rails] the initial image of the icon for the user is not displayed
- ruby - [rails] i want to create an image link using the url of the image output using active storage
- ruby - i want to display only the image of the logged-in user when executing the search function
- ruby on rails - i want to post an image by dragging and dropping
- ruby - when the search result of the model is displayed by the function to see more in kaminari, the whole is displayed instead
- ruby - image is not reflected on heroku
- jquery - i want to know how to specify the image to be displayed with the slick slider
- images are not displayed correctly with the laravel image posting function
- ruby - the view of the search screen is not displayed
- i want you to solve the mysterious phenomenon that the ruby error message is not displayed why is it evoked in view by applying
- ruby on rails 5 - after overwriting the image under assets, nothing is displayed
- jquery plugin - image is not displayed in jquerybgswitcher
- ruby - the poster's name is not displayed in showhtmlerb
- i want to know the image path from the ruby on rails controller
- ruby on rails - when i make a message, i want the date to be displayed, but i get "undefined method` strftime' for nil: nil
- ruby - resource: the server responded with a status of 404 () error
- ruby - aws deployment the asset "" is not present in the asset pipeline cannot be resolved
- ruby - about accelerating heroku's rails app
- ruby - passing variables using render partial
- ruby - i want to generate a random password (mixed alphanumeric characters)
- ruby - [posting multiple images] the src column of the image table becomes nul
- ruby - images cannot be displayed with the bulletin board posting function in rails
- how to embed code in ruby on rails
- [ruby on rails] i want to display a parent model that matches the information of the associated child model