rsanchez / json

Output ExpressionEngine data in JSON format.
http://devot-ee.com/add-ons/json/
101 stars 234 forks source link

Fully resolve file URLs #53

Closed murtaugh closed 8 years ago

murtaugh commented 8 years ago

Thanks so much for this plugin!

I'm trying to work out how to add domains to the (native) file field outputs, but am failing. I can't find where file names are spit out — any advice?

rsanchez commented 8 years ago

Native file fields store their data like this: {filedir_1}your_image.jpg, where 1 is the ID if your file upload location. That {filedir_1} will be replaced with the URL specified in the file upload location settings. You may need to add the full domain to that setting.

murtaugh commented 8 years ago

Ah, thanks. I was hoping something like that wouldn't be the solution, but it works :)

rsanchez commented 8 years ago

Not sure if this is applicable to you, but I use the upload_preferences config override for this purpose: https://docs.expressionengine.com/v2/general/system_configuration_overrides.html#upload-preferences

Allows me to dynamically set the URLs for upload locations depending on different server environments. This way I don't have to hardcode the production url there.

murtaugh commented 8 years ago

Yep, those are the variables I updated.

Thanks!