【问题标题】:Change local storage location in refinerycms for uploaded files为上传的文件更改refinerycms 中的本地存储位置
【发布时间】:2012-04-12 04:26:15
【问题描述】:

我使用的是refinerycms 1.0.9,我想更改蜻蜓保存文件的默认位置。

这是我在 config/initializers 中的 dragonfly.rb:

require 'dragonfly'

app = Dragonfly[:app_name]
app.datastore = Dragonfly::DataStorage::FileDataStore.new

app.datastore.configure do |d|
  d.root_path = '/Projects/images'
  d.server_root = '/Projects'
  d.store_meta = false
end

保存文件时出现以下错误:

Dragonfly::Shell::CommandFailed (Command failed (identify '/var/folders/5t/mf86p8gx6bz94dzfb88xpvpr0000gn/T/RackMultipart20120328-6943-1vbpa7u') with exit status 127):

更新

我重新安装了 imagemagick 并消除了错误,但它仍在将文件保存到 /system/images.我尝试在炼油厂覆盖 Image 模型并添加:

image_accessor :image do
   storage_path{ "/Projects/images/#{rand(100)}" }
end

但这也没有用。

【问题讨论】:

    标签: ruby-on-rails-3 refinerycms dragonfly-gem


    【解决方案1】:

    根据作者的this post,您似乎想在模型中设置storage_path 选项:

    storage_path{ "some/path/#{first_name}/#{rand(100)}" } # or whatever you want it to be
    

    【讨论】:

    • 我在我的幻灯片模型中添加了以下内容 image_accessor :photo do storage_path{ "slideshow/#{rand(100)}" } end 现在我得到这个错误 undefined method `photo_uid' for #<0x007f8f54e16708>
    猜你喜欢
    • 1970-01-01
    • 2012-07-21
    • 1970-01-01
    • 1970-01-01
    • 2016-04-08
    • 1970-01-01
    • 2015-05-25
    • 2020-04-02
    • 2013-06-03
    相关资源
    最近更新 更多