Display an image

Just starting out? Need help? Post your questions and find answers here.
AMpos
Posts: 42
Joined: Mon Aug 03, 2020 5:15 pm

Display an image

Post by AMpos »

I am working in an easy proyect. I have opened a window, and wat to show an image. Currently I am making it with a ImageGadget and the bindevent things.

I find it a bit complicated (although I have it working).

Is there an easy way to display an image? Something like

Code: Select all

<img border="0" src="gfx/black.jpg" width="400" height="200">
I dont plan to do anything with this image, it is just a background image and it is always the same.
munfraid
Posts: 108
Joined: Sat Mar 24, 2018 1:33 pm

Re: Display an image

Post by munfraid »

You can pass html to the Textgadget.

Code: Select all

OpenWindow(0, 0, 0, 800, 600, "Background picture")
TextGadget(0, 0, 0, 800, 600, "<img src='https://cdn.pixabay.com/photo/2016/02/19/11/19/computer-1209641_960_720.jpg'>")
AMpos
Posts: 42
Joined: Mon Aug 03, 2020 5:15 pm

Re: Display an image

Post by AMpos »

I have the picture saved at "gfx/back.jpg"

Code: Select all

TextGadget(-1, 8, 90, 480, 120, "<img src='/gfx/event.jpg'>")
does work when running in local, but after uploading it to the web, it does not find the image.

This is my site folder:

-index.htm
-index.js
-[spiderbasic/]
-[gfx/]
--gfx/event.jpg

Any hint?

Notice that if I put the full url as http://www.mysite.com/gfx/event.jpg it works online, but I have to use this /gfx/event.jpg if possible.
User avatar
Peter
Posts: 1093
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Display an image

Post by Peter »

do you define the gfx folder as resources directory in the Create App - Dialog?

Image
AMpos
Posts: 42
Joined: Mon Aug 03, 2020 5:15 pm

Re: Display an image

Post by AMpos »

Again, thank you, dude.
Post Reply