Paperclip combined with Imagemagick saves images but doesn't display them on the site

独自空忆成欢 提交于 2020-01-05 03:47:07

问题


I am using paperclip and Imagemagick to add images to a website. I have a form on the site for users to upload images. When I upload an image, it doesn't give any errors. When I check the rails console, the image is saved with the right size and all that. When I check the project folder, the images get saved in there too. But when I try to display, I get the following screen on the site(Only one image has been added, only the one on the left is supposed to show up, the missing tags on the rest are because no images are added there):Screenshot of screen

This is my index.html page:

<h1 class="current-category"><%= params[:category]%></h1>

<% if @books.count == 0 %>
    <h1>There are no books currently in this category</h1>
<%else%>
    <% @books.each do |book| %>
        <a href="/books/<%= book.id %>">
            <%= image_tag book.book_img.url(:book_index) %>
        </a>
    <% end %>
<%end%>

And I get the following error message on the terminal window:Screenshot of terminal window

Please let me know why this is happening. Thank you.

来源:https://stackoverflow.com/questions/43824679/paperclip-combined-with-imagemagick-saves-images-but-doesnt-display-them-on-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!