I have a weekly generator that zips some files. Some are assets in app/assets/images/xxx.xxx
some are uploaded via Paperclip and in public/system/env...
The file paths I have start after app
, without /images/
or public
.
I'll get something like /assets/some.png
or /system/production/xyz/some.jpg
, and these will be served fine as a URL path, but I want to collect them in a file.
How can I get the filepath of an asset?
I think this is an easier way to explain it.
Given the asset URI string, how can I find and get the asset's file path?
The asset URL path /assets/logo.png
could be one of the files:
public/logo.png
public/assets/logo.png
app/assets/images/logo.png
In production, assets should be precompile and served from the public root folder /public/assets/logo.png
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With