where to place png file to reference in url

  1. 2 months ago

    ronaldo f

    Sep 6 Pre-Release Testers, Xojo Pro Philippines

    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?

  2. Michel B

    Sep 6 Pre-Release Testers, Xojo Pro RubberViews.com

    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.

  3. ronaldo f

    Sep 6 Pre-Release Testers, Xojo Pro Philippines

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

  4. ronaldo f

    Sep 6 Pre-Release Testers, Xojo Pro Philippines

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

  5. Michel B

    Sep 6 Pre-Release Testers, Xojo Pro RubberViews.com
    Edited 2 months ago

    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.

  6. ronaldo f

    Sep 7 Pre-Release Testers, Xojo Pro Philippines

    Thanks Michel.

    Maybe I can find that solutions soonest.

  7. Michel B

    Sep 7 Pre-Release Testers, Xojo Pro RubberViews.com

    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)

  8. ronaldo f

    Sep 7 Pre-Release Testers, Xojo Pro Philippines

    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"

    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)
  9. Michel B

    Sep 7 Pre-Release Testers, Xojo Pro RubberViews.com

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

  10. Greg O

    Sep 7 Xojo Inc scout.galaxy.barn

    @Michel B 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.

  11. Michel B

    Sep 7 Pre-Release Testers, Xojo Pro RubberViews.com

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

  12. ronaldo f

    Sep 7 Pre-Release Testers, Xojo Pro Philippines

    Thanks, guys.

    It this was now added to my code snips.

or Sign Up to reply!