Paperclip will post process (resize) your images - if all validations are ok - otherwise post processing will not commence.
Paperclip supports an extensible selection of post-processors. When you define a set of styles for an attachment, by default it is expected that those “styles” are actually “thumbnails”. However, you can do much more than just thumbnail images. By defining a subclass of Paperclip::Processor, you can perform any processing you want on the files that are attached.
this image will have two resized copies, a medium and a thumb
which you may show using a helper:
<%= image_tag @user.avatar.url(:medium) %>
location of file:
(from https://github.com/thoughtbot/paperclip - understanding storage): The files that are assigned as attachments are, by default, placed in the directory specified by the :path option to has_attached_file. By default, this location is :rails_root/public/system/:class/:attachment/:id_partition/:style/:filename.
The files are saved in public/system. Read the “Storage” paragraph of the README for a better comprehension
Remember, when using CSS to show different sizes of an image, that the image is downloaded in the original size: if you show an image 200x200 px (using css) but the image is 2000x2000 (1 or 2 MB) you download the full image, which is a very slow solution!
I’ve been problems using this line: “<%= image_tag @user.avatar.url(:medium) %>”
When I use that line, in the browser I just can see text instead of the picture. And RubyMine does not recognize “avatar”. If I use this line the browser shows the picture but I cant resize the picture. **<%= image_tag @user.avatar_file_name %>**Any idea?.
I've been problems using this line: "<%= image_tag @user.avatar.url(:medium) %>"
When I use that line, in the browser I just can see text instead of the picture. And RubyMine does not recognize "avatar". If I use this line the browser shows the picture but I cant resize the picture. <%= image_tag @user.avatar_file_name %>
Is your attachment called avatar? Or is it called something else, like picture? In the example code, they are presuming that your attachment is called avatar, and everything proceeds from that point.