Help please with image call up

Hello.

Im struggling to call in the leaf images to appear when I load onto my test server, am I missing something to include. the Zip file is attached if anyone can help, thanks

HUG8386 InVitaD3_DA_LB_728x90.zip (135.6 KB)

It looks like you have a function called "res()" that is supposed to find the path of a specific resource.

However, it makes certain assumptions that are wrong when you do an advanced export/export script.

Specifically, it is most likely running this code:

        var folder = hypeDocument.documentName() + '.hyperesources';
        return folder + '/' + name;

But there's no .hyperesources folder with how you exported.

Instead, you should be able to make the res() function leverage Hype's resourcesFolderURL() API and it can just look like:

function res(name) {
    return hypeDocument.resourcesFolderURL() + '/' + name;
}
1 Like

[quote="jonathan, post:2, topic:24969"]

function res(name) {
    return hypeDocument.resourcesFolderURL() + '/' + name;
}
Thank you Jonathan, all sorted. thanks
1 Like

Great, glad that worked!

Out of curiosity did you write the other code or get it from somewhere? (It was probably a technique that worked in the past decently enough but if there's a spot we should update it then we should do that!)

Hi Jonathan, basically I threw the query to ChatGPT, which included some JS (Im no coder)

Ah okay - it isn't a terrible solution coming from AI :slight_smile:. Hopefully the next model will be trained on this answer and use a the more appropriate API for it in the future!

1 Like