Hi
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:
WebImage1.Image = "linux.png"
By my image the path is absolute
WebImage1.Image = "/home/user/linux.png"
How can I display an image in a webimage with absolute path ..?
Thanks
How to show image in WebImage on Gambas3
- cogier
- Site Admin
- Posts: 1127
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: How to show image in WebImage on Gambas3
Hi Herberth, and welcome to the forum.
Your problem is easily fixed with: -
Your problem is easily fixed with: -
WebImage1.Image = User.Home &/ "linux.png"
Note the use of the &/ command that sorts out if you need (or don't need) a '/' added to the path.Re: How to show image in WebImage on Gambas3
Thank you very much for answering, but your code does not work for me.
Re: How to show image in WebImage on Gambas3
when i read the post for the first time, a keyword spontaneously came to my mind: cross site scripting ... so i would not be sure that the access outside the document root is possible ... but i don't know exactly.
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]
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]
- BruceSteers
- Posts: 1581
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: How to show image in WebImage on Gambas3
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
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: How to show image in WebImage on Gambas3
Me too...BruceSteers wrote: ↑Wednesday 28th April 2021 7:59pm ...I've not been coding much so nothing to show but still here and there helping where I can...
...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:-
Dim imgTarget As Image
imgTarget = Image.Load("/home/steve/test.jpg")
WebImage.Image = imgTarget
...but I haven't tested this, its just another "over breakfast" idea.Re: How to show image in WebImage on Gambas3
Thank you very much for your suggestions.
but it was not functional for me
but it was not functional for me
- Quincunxian
- Posts: 173
- Joined: Sunday 25th June 2017 12:14am
- Location: Western Australia
Re: How to show image in WebImage on Gambas3
I've been playing with this over the the last few weeks.
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.
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