Obtaining the complete URL of an activity-nested file
Moodle would only allow access to the image files in a HotPot to Moodle users who are normally allowed access to that HotPot. As a result, this is not recommended as a generic way to share files in Moodle. A better way to share files, is to use a repository. However in some cases, for example sharing images among HotPots in the same course, the method you are attempting may be reasonable.
The easiest way to find out the URL would be to create a Hot Potatoes exercise that includes an image, then add that to Moodle as a HotPot activity and see what the URL of the image is when it is displayed in the browser.
Probably, the URL looks some things like this?
- https://mywebsite.com / pluginfile.php / 9999 / mod_hotpot / sourcefile / PATH/TO/IMAGE/FILE.gif
"9999" is the contextid of the HotPot activity, and "PATH/TO/IMAGE/FILE.gif" is the relative path to the image file within the HotPot's file area.
The contextid is not easy to determine without access to the database, but it does appear in some URLs, such as image URLs, if you know where to look.