Use wwwroot variable in ATTO

Use wwwroot variable in ATTO

by Matheus Gimenes -
Number of replies: 3

Hi people, I would like to know if it is possible to use the wwwroot in ATTO on the img html tags. For example I was customizing and configuring Moodle in a local network, but when I put it on the internet some images that I used in questions broke because the URL is pointing to the LAN ip adress.

So it is possible instead of using "http://lanip/moodle/urltoimage", I put the wwwroot variable located on config.php, so when I migrate the Moodle site the images keep working, like this "http://(wwwroot)/imageurl"

Average of ratings: -
In reply to Matheus Gimenes

Re: Use wwwroot variable in ATTO

by Ken Task -
Picture of Particularly helpful Moodlers

Moodle will use wwwroot variable for all internal links thus rather than using a url to images when developing on a localhost, upload the images to the localhost moodle via moodle.

When a backup of the course is made to restore to your production server, images should be included in the backup.

Please see:

https://docs.moodle.org/38/en/Images

'SoS', Ken


Average of ratings: Useful (1)
In reply to Matheus Gimenes

Re: Use wwwroot variable in ATTO

by Andrew Lyons -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hello Matheus,

The short answer is no, and we will not accept any change which introduces such a 'feature'.

The wwwroot variable is used to ensure that there is one, authoritative, URL for the site. Moodle has a number of places which expect that you are accessing it via the correct address. If you are not then you will likely enter a number of weird issues such as this one. Additionally you'll see that if you don't use the correct address the files you have uploaded will be removed after approximately 4 days because they will not have been picked up by the file processor when parsing the text, and they will therefore not be moved from the draft files area.

If you really want to use the internal IP address, then I suggest you set the IP in your local host file. Something like https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/ will help you find out how to do so.

Andrew

Average of ratings: Useful (1)