Rob
Rob

Reputation: 1855

How to add thumb versions of images I have already uploaded with carrierwave

I'm creating thumb versions of new images being uploaded and keeping the original file as well. But I've only just added this into my app and there are like 600 images already uploaded over time that don't have thumb versions. I want the images already uploaded to have thumbs as well.

I can see from reading the carrierwave docs that you can run a script to re upload images in the DB to be a different size. But this replaces the original image with the newly sized image.

Is there a way for me to do something similar to what they have there in the docs but save it to the image_thumb column and not replace the image in the original_image column? Basically run through the original_image column, resizing them and saving it to the image_thumb column.

Upvotes: 2

Views: 1029

Answers (1)

Lukas_Skywalker
Lukas_Skywalker

Reputation: 2070

Carrierwaves recreate_versions! only affects the processed versions of the uploaded files and the original file is kept as-is. That means it should be safe for you to call recreate_versions!. You can see proof for that behaviour in this pull request.

Upvotes: 2

Related Questions