A
A
Alexander Petrov2016-07-03 19:23:37
Ruby on Rails
Alexander Petrov, 2016-07-03 19:23:37

How to set the size of the image in papeclip when displaying the image?

I know that in paperclip you can specify the size of the picture in the model, and then when you upload a picture for this model, the pictures will be cropped.
BUT! How should I do.
Set the image size once for one download.
that is, I upload a picture, set it to 100 by 200, and all subsequent pictures when uploading no longer obey this rule.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Beloshitsky, 2016-07-03
@mbeloshitsky

You can do this,
but it's just telling the browser to set the width and height attributes of the image.
In general, I doubt that with the help of paperclip you can do this, because. this is not a very good solution in terms of performance. Maybe it would be better to simply specify several sizes for the picture in the model?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question