[EOS] Loading picture at runtime from variable name

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
Ddevil
Explorer
Explorer
Posts: 32
Joined: Wed Apr 29, 2020 3:04 pm

[EOS] Loading picture at runtime from variable name

Post by Ddevil »

This should be either easy or impossible, but somehow answer eludes me.
Help?

Assuming I have a picture loaded in files with name "name.jpg".
And I have a variable in the script:
var picname = "name.jpg"
Nice-Log
Explorer
Explorer
Posts: 37
Joined: Thu Dec 01, 2022 8:37 pm

Re: [EOS] Loading picture at runtime from variable name

Post by Nice-Log »

Even in a worst case scenario, you can still chain If commands with the image command as the Then and another If command as the Else. I didn't see any API methods to change images via javascript. You can check the reference guide yourself to see: https://milovana.com/eos/editor/help/api-reference
Ddevil
Explorer
Explorer
Posts: 32
Joined: Wed Apr 29, 2020 3:04 pm

Re: [EOS] Loading picture at runtime from variable name

Post by Ddevil »

Best method I currently know that is possible would be to create a new page for each picture, and then use external script to mass create those pages directly into the json file.
I would end up with thousands of pages for large galleries and I'm not sure if that's the best way to do it performance wise.

Is there anything better?
kerkersklave
Explorer At Heart
Explorer At Heart
Posts: 560
Joined: Sun Jul 06, 2014 2:11 pm
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Slave

Re: [EOS] Loading picture at runtime from variable name

Post by kerkersklave »

I had this problem once, I think I solved it with the if-chain-method, have one page for one picture and a huge if selecting the picture. I also generated the json code for that externally. The first time loading that page has a bit of a delay, but then it is fine. The only limit probably is the code size of the tease itself. I believe there is a limit on how large the json can be.
verynicekojak
Explorer
Explorer
Posts: 88
Joined: Fri Aug 19, 2022 10:05 pm

Re: [EOS] Loading picture at runtime from variable name

Post by verynicekojak »

You can have many images in one page and select one based on variable (as shown below). Variable can be set even before jumping to this page.

The problem is that all audio files from one page are loaded at once (that I checked). So I suspect that all images are also loaded at once. It would be more efficient to have one image per one page, but then you have annoying long list of pages in your tease. You must find a balance 8-).
if.png
if.png (6.21 KiB) Viewed 1412 times
Post Reply

Who is online

Users browsing this forum: No registered users and 74 guests