开发者

Paperclip: Is that possible to recreate a deleted thumbnail without uploading the original image again?

开发者 https://www.devze.com 2023-03-21 02:14 出处:网络
I use Paperclip like this: class Asset < ActiveRecord::Base has_attached_file :asset, :styles => { :thumb => \"80x80>开发者_运维知识库;\" }, ...

I use Paperclip like this:

class Asset < ActiveRecord::Base
  has_attached_file :asset, :styles => { :thumb => "80x80>开发者_运维知识库;" }, ...

When an image is uploaded, a thumbnail is created successfully.

Suppose, that for some reason, a thumbnail was deleted from the file system.

Is that possible to recreate the thumbnail without uploading the original image again ?

I tried:

Asset.find(16).save    # => true

but the thumbnail wasn't created in the file system.


Have you tried the reprocess! method? Something like

Asset.find(16).asset.reprocess!
0

精彩评论

暂无评论...
验证码 换一张
取 消