Reputation: 1852
I am using Dragonfly and would like to have longer filenames (image_uids) that cannot be "guessed". My current filenames look like this:
2019/05/14/5ep7gqqmiu_test.jpg
I'd prefer a path like this:
2019/05/14/5ep7gqqmiun96v661gt3bdscv305xnxwzmmtr0sknwscqlxq90_test.jpg
How can I add, for example, a random string between to the filename? I couldn't find an build-in option for this.
I tried to figure out where the job hash was created, but couldn't find the part in the GitHub repository.
Upvotes: 0
Views: 81
Reputation: 1852
I found the possibility to add a custom path in the docs:
storage_options do |a|
{ path: "#{date.strftime('%Y/%m/%d')}/#{SecureRandom.hex(64)}_#{a.name}" }
end
This adds a random string of 64 characters to the filename.
Upvotes: 0