Forum Discussion
Upload a photo and show later
I want to let students upload a few photos in a storyline module. These photos should then appear later in the module. I've done some testing, but I can't figure it out. Is there anyone who can give some tips on this?
I also tried it with a web-object, it didn't work either.
- BerendJanGrimmeCommunity Member
Hi Sam,
Thank yoy for your attachment. I'm sorry I was incomplete in my answer. The photo is indeed displayed, thank you for that!
The size and position of the photo changes depending on the size of the screen or the device on which the e-learning module is displayed. I tried define the relative place in javascript with % of the screen also.
I tried to put an image or web-object on the slide and replace it with de uploaded image.
In html I tried to find the ID of the object and replace it with the image. It didn't work, I think it must be technically possible. I'm just not good enough at that kind of tricky stuff.
- BerendJanGrimmeCommunity Member
Thank you for your response. I am still unable to display the image correctly. This is probably due to my skills.
- SamHillSuper Hero
Hi, did you see the Storyline file I attached? It contains the working script. I'm happy to review your file and check for any mistakes. The file I attached to my response was working correctly for me.
- SamHillSuper Hero
You were almost there. I use the data-acc-text attribute to find the element that I attached the image too. In this example, I set the ALT text to "Your image" and then use a query selector to find the element, and replace the nested SVG (the shape) with the image, e.g document.querySelector('[data-acc-text="Your image"]');
The unusual piece of code is the setTimeout I had to place on the second slide. When you first go to the slide, the image displays, but on subsequent visits, I found the image would not load. It appears to be something to do with the order of execution of script, so I put a small delay on showing the image which appears to work.