Rails Attachment_fu public_filename 问题

发布于 2024-08-07 02:48:44 字数 1682 浏览 4 评论 0原文

Attachment_fu 生成错误的 public_filename。

>> pic.thumbnails
=> ProductPicture id: 12331, product_id: nil, parent_id: 12330, content_type: "image/png", filename: "b_9788994035109_mid.png", thumbnail: "mid", size: 16562, width: 205, height: 205, created_at: "2009-10-05 02:43:50", updated_at: "2009-10-05 02:43:50", 
ProductPicture id: 12332, product_id: nil, parent_id: 12330, content_type: "image/png", filename: "b_9788994035109_thumb.png", thumbnail: "thumb", size: 2300, width: 52, height: 52, created_at: "2009-10-05 02:43:51", updated_at: "2009-10-05 02:43:51"
>> pic
ProductPicture id: 12330, product_id: 23236, parent_id: nil, content_type: "image/gif", filename: "b_9788994035109.gif", thumbnail: nil, size: 73990, width: 400, height: 400, created_at: "2009-10-05 02:43:50", updated_at: "2009-10-05 02:43:50"
>> pic.thumbnails
=> ProductPicture id: 12331, product_id: nil, parent_id: 12330, content_type: "image/png", filename: "b_9788994035109_mid.png", thumbnail: "mid", size: 16562, width: 205, height: 205, created_at: "2009-10-05 02:43:50", updated_at: "2009-10-05 02:43:50", ProductPicture id: 12332, product_id: nil, parent_id: 12330, content_type: "image/png", filename: "b_9788994035109_thumb.png", thumbnail: "thumb", size: 2300, width: 52, height: 52, created_at: "2009-10-05 02:43:51", updated_at: "2009-10-05 02:43:51"
>> pic.public_filename
=> "/product_pictures/0001/2330/b_9788994035109.gif"
>> pic.public_filename(:mid)
=> "/product_pictures/0001/2330/b_9788994035109_mid.gif"

当实际类型为“.png”(gif 是父类型)时,它会生成“.gif”而不是“.png”。

这适用于我的开发机器,但不适用于我的生产机器。

有什么想法吗?

谢谢。

山姆

attachment_fu generates wrong public_filename.

>> pic.thumbnails
=> ProductPicture id: 12331, product_id: nil, parent_id: 12330, content_type: "image/png", filename: "b_9788994035109_mid.png", thumbnail: "mid", size: 16562, width: 205, height: 205, created_at: "2009-10-05 02:43:50", updated_at: "2009-10-05 02:43:50", 
ProductPicture id: 12332, product_id: nil, parent_id: 12330, content_type: "image/png", filename: "b_9788994035109_thumb.png", thumbnail: "thumb", size: 2300, width: 52, height: 52, created_at: "2009-10-05 02:43:51", updated_at: "2009-10-05 02:43:51"
>> pic
ProductPicture id: 12330, product_id: 23236, parent_id: nil, content_type: "image/gif", filename: "b_9788994035109.gif", thumbnail: nil, size: 73990, width: 400, height: 400, created_at: "2009-10-05 02:43:50", updated_at: "2009-10-05 02:43:50"
>> pic.thumbnails
=> ProductPicture id: 12331, product_id: nil, parent_id: 12330, content_type: "image/png", filename: "b_9788994035109_mid.png", thumbnail: "mid", size: 16562, width: 205, height: 205, created_at: "2009-10-05 02:43:50", updated_at: "2009-10-05 02:43:50", ProductPicture id: 12332, product_id: nil, parent_id: 12330, content_type: "image/png", filename: "b_9788994035109_thumb.png", thumbnail: "thumb", size: 2300, width: 52, height: 52, created_at: "2009-10-05 02:43:51", updated_at: "2009-10-05 02:43:51"
>> pic.public_filename
=> "/product_pictures/0001/2330/b_9788994035109.gif"
>> pic.public_filename(:mid)
=> "/product_pictures/0001/2330/b_9788994035109_mid.gif"

It generates ".gif" instead of ".png" when the actual type is '.png' (gif is the parent's type)

This works ok with my dev machine but not with my production machine.

Any idea?

Thanks.

Sam

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

相思故 2024-08-14 02:48:44

我想通了。

我没有在 Attachment_fu 中指定 :processor ,它使用安装的任何处理器。
我的开发机器有 ImageScience 和 RMagick,而我的生产机器只有 RMagick。
ImageScience 将 gif 大小调整为 png,因为它不能很好地处理 gif。

I figured it out.

I didn't specify :processor in attachment_fu and it uses any processor installed.
My dev machine has ImageScience and RMagick and my production machine had only RMagick.
ImageScience resizes gif to png as it can't handle gif very well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文