Revision 40d327d8
Added by Marc Dequènes over 14 years ago
- ID 40d327d866c022b12e8eb7d0231906584d5b1392
app/models/artwork_step_image.rb | ||
---|---|---|
attr_accessor :saved_attachment
|
||
|
||
def thumbnail(size)
|
||
self.artwork_step_thumbnails.find_by_thumbnail(size.to_s)
|
||
thumb = self.artwork_step_thumbnails.find_by_thumbnail(size.to_s)
|
||
if thumb.nil?
|
||
regen_thumbnail(size)
|
||
else
|
||
thumb
|
||
end
|
||
end
|
||
|
||
def regen_thumbnail(size_name)
|
||
return unless self.exists?
|
||
|
||
size = attachment_options[:thumbnails][size_name]
|
||
temp_file = create_temp_file
|
||
create_or_update_thumbnail(temp_file, size_name, size)
|
||
end
|
||
end
|
Also available in: Unified diff
[fix] tries to regen missing thumbnail