Ruby EXIFR 找不到文件

发布于 2024-10-08 12:14:51 字数 360 浏览 0 评论 0原文

我正在尝试使用 EXIF 阅读器,但仍然收到错误“Errno::ENOENT: No such file or directory”,

我已经检查过,该文件肯定存在于我将其定向到的位置:(

<%= EXIFR::JPEG.new('/system/datas/5/original/IMG_0011.JPG').date_time %>

这是回形针的位置)在上传时放置文件)

有关为什么我继续收到此错误的任何想法。我认为问题可能不是找到文件,但该错误掩盖了真正的问题。

我需要从图片文件中检索 EXIF 数据。欢迎任何其他想法。我正在使用回形针上传文件。

谢谢!

I am trying to use the EXIF reader and I continue to get the error "Errno::ENOENT: No such file or directory"

I have checked and the file most certainly exists in the location I am directing it to:

<%= EXIFR::JPEG.new('/system/datas/5/original/IMG_0011.JPG').date_time %>

(This is where paperclip puts the files upon uploading)

Any ideas on why I continue to receive this error. I think the problem may not be finding the file but that error is masking the real issue.

I need to retrieve the EXIF data from picture files. Any other ideas are welcome. I am using paperclip to upload files.

Thanks!

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

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

发布评论

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

评论(2

再见回来 2024-10-15 12:14:51

您提供给 EXIFR 的路径是 URL,而不是系统上的路径。尝试一下:

$ ls /system/datas/5/original/IMG_0011.JPG

该文件存储在 Rails 应用程序的 public 目录中,因此请执行以下操作:

EXIFR::JPEG.new(Rails.root.join('public', '/system/datas/5/original/IMG_0011.JPG')).date_time

但是回形针还提供了访问路径的方法,那就是通过 path代码>方法:

@model.data.path

The path you provided to EXIFR is a URL, not a path on the system. Try it:

$ ls /system/datas/5/original/IMG_0011.JPG

The file is stored in the public directory of your rails app, so do something like:

EXIFR::JPEG.new(Rails.root.join('public', '/system/datas/5/original/IMG_0011.JPG')).date_time

But paperclip also provides a method to access the path, and that is through the path method:

@model.data.path
婴鹅 2024-10-15 12:14:51

这对你有用吗

<%= EXIFR::JPEG.new(Rails.root.join('public/system/datas/5/original/IMG_0011.JPG')).date_time %>

Does this work for you

<%= EXIFR::JPEG.new(Rails.root.join('public/system/datas/5/original/IMG_0011.JPG')).date_time %>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文