where to place png file to reference in url

Hi Guys,

I had “logo.png” that I need to reference it from an external app.

while testing, I tried to copy the logo.png to the debug root folder. But when I typed http://127.0.0.1:8080/logo.png the browser return 404: file not found.

Anybody know where to put the logo.png so that it can be referred by an external app?

What you are trying cannot work because a standalone app is not a web space.

Your best bet would be to rent a cheap web space and put logo.png there.

Meaning, any icon or images bundled from the compiled web app is now sharable, am I correct?

How about using HandleSpecialURL /api ? Can it return picture so that external app can use it?

If you can find a way to serve the picture, yes indeed.

You will have to find a way to Request.Print() the picture data in HandleURL, in response to such a URL as:

http://127.0.0.1:8080/pictures/logo.png

You could probably use a MemoryBlock to store the picture data, and read it as a string to print it.

Thanks Michel.

Maybe I can find that solutions soonest.

This will help:

Dim p As Picture = Canvas1.Backdrop Dim mb As MemoryBlock = p.GetData(Picture.FormatJPEG, Picture.QualityMax) Dim s As String = mb

I found this here:
https://forum.xojo.com/12785-store-picture-in-blob/0

Basically, it should be as simple as verifying in HandleURL that the path indeed contains “pictures”, and the name of the file.

Then Request.Print(s)

Thank Michel for your help.

I resolved my problem using your assistance. Here is the code to make photo available to the public using “handleurl”

[code]Dim f As FolderItem
f = GetFolderItem(“logo.png”)

Dim p As picture
p = picture.Open(f)

Dim mb As MemoryBlock = p.GetData(Picture.FormatJPEG, Picture.QualityMax)
Dim s As String = mb

Request.Header(“Content-Type”) = “Image/jpeg”
Request.Print(s)[/code]

You can dispense about the first 4 lines by simply dragging the picture in the project.

If the image isn’t actually used in the web project, that’s unnecessary overhead. Besides, he wanted to know how to serve the file from disk.

Fortunately, I was here to help in the first place, as misguided as I was :confused:

Thanks, guys.

It this was now added to my code snips.