When I upload an image from rich_text_area to S3 using Action_Text in the production environment, the image is only displayed from the edit screen.
By the way, the image is saved in S3, and the image uploaded in file_field can be displayed.
I would appreciate it if you could let me know if anyone knows that the image only appears on the edit screen and does not appear in the production environment.
Views (Forms)
<div class="user-form__field_title">tag</div>
<%=text_field_tag'article [tag_list]',article.tag_list,class:"form-control"%>
<div class="user-form__field_title">Thumbnail</div>
<%=f.file_field:thumbnail,direct_upload:true,accept:"thumbnail/png,thumbnail/jpeg,thumbnail/gif,thumbnail/jpg"%>
<div class="user-form__field_title">Banner</div>
<%=f.file_field:banner%>
<div class="user-form__field_title">Content</div>
<%=f.rich_text_area:body%>
<div class="user-form__field__create">
<%=f.submit:class=>"user-form__field__create_button"%>
</div>
Views (Show Page)
<div class="article-body__box__lead">
<%[email protected]%>
</div>
_blob.thml.erb hides captions, gigabytes, and file names.
<figure class="attachment attachment --<%=blob.represented??"preview":"file"%>attachment--<%=blob.filename.extension%>">
<%if blob.represented?%>
<%=image_tagblob.representation(resize_to_limit:local_assigns[:in_gallery]?[800,600]:[1024,768])%>
<%end%>
<%# Comment out to hide captioning below %>
<%#<figcaption class="attachment__caption">%>
<%#<%if caption=blob.try(:caption)%>
<%#<%=caption%>
<%#<%else%>
<%#<span class="attachment__name">%=blob.filename</span>%>
<%#<span class="attachment__size">%=number_to_human_size blob.byte_size</span>%>
<%#<%end%>
<%#</figcaption>%>
</figure>
Controller
before_action: set_article, only: [:show,:edit,:update,:destroy]
def show
[email protected]+1
@article.update(views:views)
end
private
default_article
@article=Article.find (params[:id])
end
I solved myself!!
Apparently, it was necessary to introduce image magic!!
Thank you.
© 2024 OneMinuteCode. All rights reserved.