在Carrierwave中重新处理图像 [英] Reprocessing images in Carrierwave

查看:67
本文介绍了在Carrierwave中重新处理图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我的模型的图片带有:thumb ,客户想要的是:tiny :nano 缩略图。

Let's say my model has an image with :thumb and the client wants :tiny and :nano thumbnails.

如何使用rake任务重新处理所有现有图像?

How do I reprocess all the existing images using a rake task?

我发现了一个我认为可以完成的耙任务 https://gist.github。 com / 777788 ,但它给了我错误。

I've found a rake task that I thought would do it https://gist.github.com/777788 but it's giving me errors.

推荐答案

根据Carrerwave文档,您可以使用以下命令: / p>

According to the Carrerwave documentation you can use following commands:

Model.all.each do |model|
  model.image.recreate_versions!
end

这篇关于在Carrierwave中重新处理图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆