LMSouq
moodle-core Open

Moodle export lesson contents with images

PR
Primoz Rome
1 month ago
3 views
Problem Description
I am trying to export Moodle lesson content from Moodle database, but I am having problems exporting images. Moodle stores lesson HTML in a MySQL database but images are referenced and need to be replaced in the HTML string. For example. This is the source html that is saved in Moodle DB: <p> <img style="display: block; margin-left: auto; margin-right: auto;" src="@@PLUGINFILE@@/sound_card_zpstlml0qfv.png" height="492" width="720" / </p> Moodle transforms this into final html: <p> <img style="display: block; margin-left: auto; margin-right: auto;" src="http://mymoodleserver.com/pluginfile.php/553/mod_lesson/page_contents/1725/sound_card_zpstlml0qfv.png" height="492" width="720" / </p> I have figured out that @@PLUGINFILE@@ needs to be replaced with the path to the image file but I just don't know what is the first number in the final image URL. I guess it is some ID but I can figure out what. I figured out the second number in the URL is `id` from `lesson_pages` table. http://mymoodleserver.com/pluginfile.php/SOME_ID/mod_lesson/page_contents/PAGE_ID/image_file.jpg

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base