Convert Media File Urls to Permanent URLs (/getmedia/)

Dave Forster asked on June 22, 2016 11:43

textWe have a few environments for a site where the Media Libraries are configured slightly differently.

Our local and QA instances use a shared media library (i.e. a custom media libraries folder). Whenever we use the media file selector form control to select images from this library it uses the permanent url (starting with /getmedia/) - this is fine for us.

We also have another instance (a preprod) instance which doesn't use a shared media folder but uses the default media folder setting. We have noticed that when selecting images here, the Direct URL is used... and none of the resizing parameters we append work - it always serves the full image. In order to get this to behave like the local & QA environments we need to actively set the "User permanent urls" setting on this environment. (NOTE: This setting isn't enabled on our local/qa instances - so I'm assuming that using a custom folder automatically enables this behaviour regardless of the setting ??)

My question is, is there an easy/obvious way to automatically update all the previously set image urls to use permanent urls - currently we are having to go through all previously created pages and manually select the images again just so it picks up the permanent url. We've only just noticed this behaviour when investigating some performance issues.

Recent Answers

Jan Hermann answered on June 22, 2016 12:03

I am not aware of any simple approach of converting direct media urls to permanent ones. The problem is that many of our form controls simply stores the url/path to the media file (not just some GUID reference) so it just a string you can use to render/access the file.

0 votesVote for this answer Mark as a Correct answer

Dave Forster answered on June 22, 2016 12:12

Hi Jan,

Are you able to confirm that setting a custom media file folder also changes the permanent/direct url behaviour too, as we have observed. There doesn't appear to be anything in the documentation to suggest this

0 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on June 22, 2016 12:43

I am not sure what you mean by that. Changing target location for storing media files doesn't have any influence on final url (except for different path of course). You always have both two options to access the file (direct path / permanent url).

It depends on the form control you use for selecting media files. For example, when I tested the Media selection form control, it correctly followed settings (it stored permanent urls according to my configuration).

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.