Step by step to save an image and get it's xano url?

Options
Feeling extra dumb today so i hope someone can help spell this out for me.

I went through this document and it's still unclear to me how to save an image to the database from an API call coming from Draftbit, and then get the URL of the saved image to use in a function.

I also don't understand what's arriving in the file resource image input, and what's the difference and use between all these options:
[Image]
What would be the step by step to save an image and get the URL?

Thanks

Comments

  • JJ
    JJ Member
    Options
    Hi.
    Usually I am sending a URL to XANO via POST, then I use the first option "Create Image Metadata" into a variable
    the "mImage_" is where I send the Image URL (In your case a Drafbit image upload, something like that).[image.png]Then I edit the record, using a field Image to update with the "VAR_1"

    [image.png]the action "2." will add the image to the database and response should give you the Image URL from XANO.
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     

    Creating images, videos, attachments follow these steps:

    1st - input your image using the File Resource input type
    2nd - Create the Metadata from the File Resource using the Create Metadata function... (there are specific Create Metadata Functions depending if you're doing an image, video, audio file, or attachment)
    3rd - Using the Variable created from the Create Metadata Function, map this to the storage field in your DB table.

    The image URL isn't actually stored as part of the metadata. The URL is generated on the fly when retrieving a file from the Database for convenience. You can create an image URL once you have the Metadata (so even before adding it to the database). The URL consists of your Xano domain (e.g. https://x1xx-abcd-aaaa.n7.xano.io) and the "path" which is part of the Metadata object. If you concatenate both values you get the URL. 
  • Jay
    Jay Member
    Options
     Thanks, this clarifies most of it. But the url part is still not clear to me. There isn't anything that just generates it and provides it whole? Do i always have to construct it for the url and path?
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     Database request functions (e.g. Edit Record, Get Record, Add Record, etc.) will be the only functions that give you the URL automatically
  • Jay
    Jay Member
    Options
     I'm creating an image and adding it to the db like this:
    [image.png]The output is this:
    [image.png]Then i try to use the returned object Feedback.Image:
    [image.png]But what i see in the email api call is this big neted structure:
    [image.png]
  • Jay
    Jay Member
    Options
    Michael Udinski any insight?
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     I'm a little confused here -can you please help clarify here. I'm seeing your last screenshot which looks like an External API Request response -- is this somehow related to adding an image to your database or am I missing something?