mass edit image location

mass edit image location

by mark acton-grieves -
Number of replies: 3
Hello, I have inherited a Moodle installation (i'm a complete noob) that recently fell over.
We have got the instance up and running in  a hosted environment but none of the slide images have gone with the restored instance.
I think when it was initially set up, the images that are on our network were linked to from within the course.
Now that it is hosted the links no longer work.
We have 5 locations that access the learning environment and many of the courses are replicated for different positions at each of these sites (we're a retailer).
Currenlty, the only way i know to add the slides back to the courses, is to drag and drop them, but i need to repeat this every single time.

Is there a wy to 'upload' the iamge to Moodle then mass edit the replicated courses to point to the correct slides (they are in .jpg format)

We have access to the folder structure and the .sql through phpmyadmin
Although i'm in IT, i am not used to using these tools so unused to the acronyms nad such in this environment.

I appreciate any help that anyone can provide.

Many thanks in advance


Average of ratings: -
In reply to mark acton-grieves

Re: mass edit image location

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

If I'm reading your post correctly, your Moodle site is now in a new location. Is that right? If it is, have you used the replace tool to fix all your picture links?

Read about it here: https://docs.moodle.org/31/en/Search_and_replace_tool

In reply to AL Rachels

Re: mass edit image location

by mark acton-grieves -

This looks as though it may be of use.

Currenlty the images are on a local server, is there a way to upload all the files to a directory  on the new server, would this just be creating a folder and moving the photos?

Then looking at the current place holder and changing it to point to the new location?

one thing i noticed was that the current picture location doesn't seem to point to a 'proper' location

moodlesite.com/pluginfile.php/1098/mod_lesson/page_contents/10888/Slide1.JPG

In reply to mark acton-grieves

Re: mass edit image location

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Unfortunately, I think you are probably out of luck on this.  It appears that moodle hashes the actual location in the database (which is a pretty good security measure of course) so it is not as though you could just run a nice little script to update the physical location of the files.  

The only thing I could see is if perhaps you can create the same path to your folder on the new server, at which point, moodle should just see them as they would be in the place that it was expecting them.

If you can't do that, in the long run, I think you are going to have to manually replace them all to keep in sync with the site going forward.

Maybe someone else has a better solution...