Image referencing in C++[SOLVED]


#1

I’m not the best (nowhere close) at coding and all that, but I would like to know how I would reference to images in the assets in C++. I have tried directories like assets/genericimagename.png or just the image name and I only get “Their is no such directory as” assets/blah blah blah. When I try put in Raw image code it sort of crashes glitch so it would be great if you could help me out.

EDIT:

like this:

{ files: [{ attachment: result, name: '-----/-----/example.png' }]


#2

hey bobguyTDG,

you can get the url of a file in your assets by clicking on it and then clicking ‘copy url’. The url will be an absolute path that you should be able to drop directly into an <img> tag etc


#3

<img><\img> is HTML code I am using C++ .js files, I am trying to reference the image like this

{ files: [{ attachment: result, name: '------/-------/example.png' }]

I am trying to find the directory to use the image in my assets


#4

can you use absolute url paths? so if you look in the sidebar you’ll see an ‘assets’ entry. click that, and you can drag in files to upload. then click an uploaded file thumbnail to get the image url path


#5

const plate = await fsn.readFile('-------/------/example.jpg');

Exact line of code :arrow_up:

the URL will not work, the code will only accept a legitimate file directory and I don’t know if that is possible with the way glitch works.


#7

Follow the steps in this link below then


#8

Thank you very much, this worked.