How to show image in WebImage on Gambas3
Posted
#1
(In Topic #641)
Trainee

I need to display an image (webimage) that is not in my project's public folder.
I know that if my image it is in my project the code would be:
<COLOR color="#0000BF">WebImage1.Image = "linux.png"</COLOR>
By my image the path is absolute
<COLOR color="#0000BF">WebImage1.Image = "/home/user/linux.png"</COLOR>
How can I display an image in a webimage with absolute path ..?
Thanks
Posted
Guru


Posted
Trainee

Posted
Enthusiast

maybe you have to copy/move the image file manually via shell/exec into a folder inside and then access it with a relative path
but if charlie or steve (bruce has unfortunately become exceptionally quiet) have no ideas this is generally a very bad sign …
[DeepL is my friend]
Posted
Banned
PJBlack said
but if charlie or steve (bruce has unfortunately become exceptionally quiet) have no ideas this is generally a very bad sign …
[DeepL is my friend]
I've not been coding much so nothing to show but still here and there helping where I can
I know almost nothing about using the web components though so not had much to input on this , i'll say my 2 bits worth…
It looked to me like it made it's own virtual server , i'm not so sure reaching outside via the filesystem is possible.
could it be done with a socket?
maybe a gambas desktop app listening on a socket could send the files in a more http way via a request from the gambas web app?
Gambas web works very different to normal gambas.
Or if you are running an apache server you could manage access to local folders that way
Posted
Regular

BruceSteers said
…I've not been coding much so nothing to show but still here and there helping where I can…
Me too…
…and when I'm allowed to play by "The Boss" I'm currently spending 95% of any play-time trying to 'tame' my 3D printer!
I also know nothing about this component, and when you look at the Help for Webimage.Image it just says: "This symbol does not exist."
I know the Devs are not keen on people using absolute addressing, so maybe its coded that way.
However, you could try to grab the image and then pass it on. Maybe something like:-
…but I haven't tested this, its just another "over breakfast" idea.
Posted
Trainee

but it was not functional for me
Posted
Expert


Writing the path so: <img source='file:///[path to image].image.png'> stopped working.
I think that this may be a security thing but it's hard to be sure.
The solution I found that works is placing the images to be displayed in a folder structure like so:
MyWeb
|–WebPages
|–Images
Any web page in in the structure can then use <img src='../Images/image.png'>
This is the only way I could get images to display at all in local web pages.
The last time the normal 'file:///' method worked was about 2 months(?) ago.
Cheers - Quin.
I code therefore I am
I code therefore I am
1 guest and 0 members have just viewed this.

