ruby-on-railsdragonfly-gem

Rails: Dragonfly UID not found although it displays the path correctly


I have a Filemanager app, which doesn't use a Model and doesn't store anything in the database. Thus, I had to do the setup a bit differently. My setup is as follows:

When generating the files

files.each do |file|
    filesObj = {
        "name" => file,
        "path" => File.expand_path(directory_name + '/' + file),
        "modified" => File.ctime(directory_name + '/' + file),
        "size" => (File.size(directory_name + '/' + file).to_f / 2**20),
        "url" => url + file,
        "thumb_url" => 'http://' + request.host_with_port() + '/' + dragonfly.app.fetch(url_path + '/' + file).thumb('400x200').url
      }
end

The urls are generated properly, one such url is: http://localhost:3000/media/W1siZiIsIi9tZWRpYS8xLkpQRyJdLFsicCIsInRodW1iIiwiNDAweDIwMCJdXQ?sha=051428e06f681fb2

When I go to that URL, I get the following in the terminal: Started GET "/media/W1siZiIsIi9tZWRpYS8xLkpQRyJdLFsicCIsInRodW1iIiwiNDAweDIwMCJdXQ?sha=051428e06f681fb2" for ::1 at 2017-03-01 12:57:58 -0500 DRAGONFLY: uid /media/1.JPG not found DRAGONFLY: GET /media/W1siZiIsIi9tZWRpYS8xLkpQRyJdLFsicCIsInRodW1iIiwiNDAweDIwMCJdXQ?sha=051428e06f681fb2 404

The file exists in the media folder. Any idea why it's failing?


Solution

  • It failed for a couple of reasons

    1. I didn't have ImageMagick installed.
    2. The gem is outdated, it looks for convert command, which the ImageMagick dropped from version 7.0.