MIniMagick::Image.write() 以不同的权限保存文件
我正在用 Rails 3.0.11 和 MiniMagick 编写一个小照片库。
def JadeImage.rescale path,new_path,max_height=150
image = MiniMagick::Image.open(path)
image.adaptive_resize(self.resize(image[:height],max_height))if image[:height] > max_height
image.write(new_path)
end
我用它来保存同一张照片中的两个调整大小的图像。其中一个文件以 644 权限保存,一切正常。另一个总是保存为600,因此无法在网页中显示。
现在,保存它们后,我运行一个小实用程序将该目录中的所有内容设置为 644,这样它现在就可以工作了。
有什么原因会发生这种情况吗?
I am writing a little photo gallery with Rails 3.0.11 and MiniMagick.
def JadeImage.rescale path,new_path,max_height=150
image = MiniMagick::Image.open(path)
image.adaptive_resize(self.resize(image[:height],max_height))if image[:height] > max_height
image.write(new_path)
end
I am using this to save two resized images from the same photo. One of the files gets saved with 644 permissions and all is right in the world. The other always get saved as 600 and as such can't be displayed in the webpage.
For now, after saving them, I run a little utility to set everything in that directory as 644 so it works now.
Is there any reason why this would occur?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是我最终解决这个问题的方法。如果您使用 apache 尝试添加到您的 apache2.conf
This is how I resolved this issue on my end. If you are using apache try adding to your apache2.conf