0
votes

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

2
Why do you want to upload 10 images if only one is processed an the others will be ignored anyway? - spickermann
for example i have an article, and there are 10 imagesin article, but i need to process only first for home page, so i don't need to process other 9 images with size only for home page - Boris Kuzevanov

2 Answers

1
votes

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
0
votes

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).