Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to paperclip:refresh just a particular type of thumb?

My photo model has a few different versions, and I only updated the tiny_thumb. Can I just refresh that one type rather than all the other types as well?

A clip from my model:

class Photo < ActiveRecord::Base
  has_attached_file :photo, 
      :styles => { :cropped_thumb => {:geometry => "115x70#", :jcrop => true}, :resized_thumb => {:geometry => "115x70>"}, :deal => {:geometry => "64x56#"},  
      :cropped_large => {:geometry => "#{PHOTO_IMAGE_WIDTH}x#{PHOTO_IMAGE_HEIGHT}#", :jcrop => true},
      :resized_large => {:geometry => "#{PHOTO_IMAGE_WIDTH}x#{PHOTO_IMAGE_HEIGHT}>"},
      :tiny_thumb => {:geometry => '120x120>'},

I tried this..

rake paperclip:refresh:tiny_thumb class=Photo

But I think it was a poor guess and didn't work.

like image 739
Trip Avatar asked Oct 26 '25 17:10

Trip


1 Answers

I haven't tried but you can do this in your ruby script:

Photo.all.each{ |instance| instance.photo.reprocess!(:tiny_thumb) }
like image 106
kain Avatar answered Oct 28 '25 11:10

kain