lusfernandos
asked on
how to get a paperclip style file_size
Hi I am using paperclip to deal with images files, and I want to show in a list the file size of a style.
My styles are:
:styles => {:small => "200x200>", :medium => "300x300>", :thumb => "60x60>"}
In a view I am getting the image original size, however I want to show the :medium filesize
Here is how I am showing in the view
<td><%=h number_to_human_size(photo .photo_fil e_size)%>< /td>
I guess that I need to use (:medium) somewhere but I don't know where, or if I really need to use some other function to get the style size, I think the only size paperclip stores is from the original image.
Thanks for your support.
My styles are:
:styles => {:small => "200x200>", :medium => "300x300>", :thumb => "60x60>"}
In a view I am getting the image original size, however I want to show the :medium filesize
Here is how I am showing in the view
<td><%=h number_to_human_size(photo
I guess that I need to use (:medium) somewhere but I don't know where, or if I really need to use some other function to get the style size, I think the only size paperclip stores is from the original image.
Thanks for your support.
ASKER
Hi doades,
Unfortunately, that didn't work !
Unfortunately, that didn't work !
Looking at the paperclip website it looks like you need something like this:
<%= image_tag @photo.photo.url(:medium) %>
to show the image in that size, e.g. 300x300
I'm not 100% sure about what you mean by show the filesize, do you mean show the size of the file as in size on disk?
Andrew
<%= image_tag @photo.photo.url(:medium) %>
to show the image in that size, e.g. 300x300
I'm not 100% sure about what you mean by show the filesize, do you mean show the size of the file as in size on disk?
Andrew
ASKER
I am able to show the images with all styles.
however I need to show the filesie from a specific size. The filesize I am currently able to show is for the original image.
however I need to show the filesie from a specific size. The filesize I am currently able to show is for the original image.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Andrew
Open in new window