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_file_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.
Who is Participating?
lusfernandosConnect With a Mentor Author Commented:
ok, I got it working.

should be something like:

    <td><%=h number_to_human_size(File.size( %></td>  
Andrew DoadesIT TechnicianCommented:
I believe you use something like below..

<td><%=h number_to_human_size(photo.photo_file_size(:medium))%></td>

Open in new window

lusfernandosAuthor Commented:
Hi doades,

 Unfortunately, that didn't work !
Andrew DoadesIT TechnicianCommented:
Looking at the paperclip website it looks like you need something like this:

<%= image_tag %>

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?

lusfernandosAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.