如何删除回形针中的现有样式尺寸 [英] how to remove existing style dimensions in paperclip

查看:155
本文介绍了如何删除回形针中的现有样式尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道你可以添加新的样式到回形针,然后使用过程!方法强制回形针填写缺少的样式。但是如果你想抛弃那些你不再使用的旧款式呢。例如,我有iphone和ipad的样式,我改变了主意,而是改为:large和:medium,它们的尺寸略有不同,而不是:iphone和:ipad。



特别是我在s3上托管我的图片,因为我的应用程序在heroku上。我想删除所有有关:iphone和:ipad风格的文件夹。有没有去除选择风格rake任务?


解决方案

在你的终端上运行。



  rake -T回形针

你可以看到像这

  ... 
rake paperclip:clean#清除无效附件。
rake paperclip:refresh#刷新元数据和缩略图。
rake paperclip:refresh:metadata#重新生成给定CLASS(和可选附件)的content_type / size元数据。
rake paperclip:refresh:missing_styles#为所有使用Paperclip的类重新生成缺失的缩略图样式。
rake回形针:refresh:thumbnails#重新生成给定CLASS的缩略图(以及用逗号分隔的可选附件和样式)。
...

用于刷新缩略图试试这个

 耙回形针:刷新:缩略图类= XYZ#XYZ替换为您的类名

删除

  rake paperclip:clean#清除无效附件。 


I know you can add new styles to paper clip and then use process! method to force paperclip to fill in the missing styles. But what if you want to ditch the old styles that you are not using any more.

For example I have styles iphone and ipad, and I changed my mind and would instead like :large and :medium with slightly different dimensions instead of :iphone and :ipad.

In particular I'm hosting my images on s3 since my app is on heroku. I would like to remove all the folders on s3 pertaining to :iphone and :ipad styles. Is there a rake task for removing select styles?

解决方案

run in your terminal

rake -T paperclip

you can see like this

...
rake paperclip:clean                    # Cleans out invalid attachments.
rake paperclip:refresh                  # Refreshes both metadata and thumbnails.
rake paperclip:refresh:metadata         # Regenerates content_type/size metadata for a given CLASS (and optional ATTACHMENT).
rake paperclip:refresh:missing_styles   # Regenerates missing thumbnail styles for all classes using Paperclip.
rake paperclip:refresh:thumbnails       # Regenerates thumbnails for a given CLASS (and optional ATTACHMENT and STYLES splitted by comma).
...

for refreshing your thumbnail try this

rake paperclip:refresh:thumbnails class= Xyz # xyz replace with your class name

for removing

rake paperclip:clean                    # Cleans out invalid attachments.

这篇关于如何删除回形针中的现有样式尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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