Boris Kuzevanov
Boris Kuzevanov

Reputation: 1302

Rails carrierwave resize only one image

i do multiple upload of images with carrierwave, also resize. For example, i've uploaded 10 images, and carrierwave has create 3 version of any image so i've 30 images. But i need, that carrierwave will create 3 versions only of FIRST image, and other 9 must ignore.

How i can do it?

Thanks

Upvotes: 0

Views: 79

Answers (2)

yivo
yivo

Reputation: 3594

It depends on your code, what and how you are doing. Generally you should create two different carrierwave uploaders and mount one for primary image (e. g. ArticlePosterUploader) and other for all other images (e. g. ArticlePictureUploader).

Upvotes: 0

SteveTurczyn
SteveTurczyn

Reputation: 36860

Create different uploaders, and only create the thumbnail images within the first uploader

class Article < ApplicationRecord

  mount_uploader :main_image, ThreeSizeUploader
  mount_uploader :extra image, StandardUploader

end

Upvotes: 1

Related Questions