使用 Attachment_fu,如何编辑现有照片、仅更新缩略图并保留原始照片不编辑?

发布于 2024-08-02 13:37:31 字数 395 浏览 16 评论 0原文

使用attachment_fu上传并创建照片后,有没有办法只编辑缩略图并保持原始状态不变?我了解如何调整大小或裁剪,但它是将编辑应用于所有缩略图和原件,这就是我确信attachment_fu 的工作原理。

例如,假设在照片库应用程序中,用户上传图像并需要裁剪图像,但可能需要裁剪多次。这需要返回原始图像再次裁剪。

该线程解决了裁剪时更新缩略图的核心问题(使用 Kropper): http://groups.google.com/group/attachme … c4d14be02d

有没有更简单的方法通过破解或修补 Attachment_fu 来绕过更新原始版本?

After a photo is uploaded and created using attachment_fu, is there a way to edit just the thumbnails and leave the original as it is? I understand how to do the resizing or cropping, but it's applying the edits to all of the thumbnails and the originals, which is how I'm sure attachment_fu was intended to work.

For example, say in a photo gallery app the user uploads an image and needs to crop the image, but may need to crop it several times. This would require going back to the original image to crop again.

This thread addresses the core issue of just updating thumbnails when cropping (using Kropper):
http://groups.google.com/group/attachme … c4d14be02d

Is there a simpler way to to bypass updating the original by hacking or patching attachment_fu?

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

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

发布评论

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

评论(1

笑咖 2024-08-09 13:37:31

我认为你最好的选择是将初始图像上传作为模型的单独文件附件。您可能有诸如“original_image”和“cropped_image”之类的东西。

然后,当您需要进行编辑时,只需从原始图像重新加载即可:

# From attachment_fu docs, code to "upload" from local path
@attachable = AttachmentMetadataModel.new(:uploaded_data => ActionController::TestUploadedFile.new(path, mimetype))
@attachable.save

I'd think your best bet would be to have the initial image upload be a separate file attachment to your model. You might have something like original_image and cropped_image.

Then when you need to make your edits, just reload from the original image:

# From attachment_fu docs, code to "upload" from local path
@attachable = AttachmentMetadataModel.new(:uploaded_data => ActionController::TestUploadedFile.new(path, mimetype))
@attachable.save
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文