Ruby on Rails Saturday, April 5, 2014

Hi Alfredo,
both your questions are answered in the README of the github project: https://github.com/thoughtbot/paperclip

The sizes can be choosed with the :styles param of the `has_attached_file` method (in the model):

has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }

In your view you can select the style to show:

<%= image_tag @user.avatar.url(:medium) %>

The files are saved in public/system. Read the "Storage" paragraph of the README for a better comprehension

NOTE:
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! :)
Use CSS only for minimal changes of size.

Bye



2014-04-05 8:55 GMT+02:00 Alfredo Barrero <abarrero90@gmail.com>:
Good afternoon everyone.


Im using the gem Paperclip in order to upload the images of the users to my server. But I having problems with it. I don't know how to resize the image size after uploading the image.

I'm using CSS to try to change the size but is not working. I think Paperclip is showing the exactly size that it was saved. Could anyone help me?.


Another question is about the location of the pictures that the gem Paperclip is using. When I add a picture with this gem, Where it is saved?.


Thank you & best regards.

Alfredo.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d057d5d7-a3cf-42da-a648-a7c154ed5b24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAK4fz2r1hQ3ZtU4qDyKheymZdvmCtZqFrc0QZ0E4e2H7E4guuQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment