Download an Image & Store it in a Xano Database

Options
Hello!

I'm currently following along with this video, Download an Image & Store it in a Xano Database, to try to access an image at a url endpoint and download it to my database.

The problem I'm running into is that when I try to Create Image Metadata (seen at this moment in the video) it consistently gives me this response:
```
Whoops! An error occurred.
Exception: Unsupported input
```

Stepping through the Function Stack, the issue seems to come at that Create Image Metadata step, where it seems that the function doesn't receive any input:
[image.png]Here's a screenshot of what my function stack looks like:[image.png]
I believe I'm following exactly the steps described in the video. Let me trace them:
1. Request the image with External API Request ✓
2. Use a filter to convert it to base64 ✓
3-4. Prepend the web data header `data:image/jpeg;base64,` using concat fliter ✓
5. Create Image Metadata (aka Create Image from File, for some reason the function name and the tooltip are different) ✓

[image.png]Any ideas what might be causing this? It feels like I'm doing things right

One final thing: I have confirmed that the image data that I'm trying to decode is properly formatted. If you'd like to try yourself here is the base64 text: [image.txt]

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Before creating the image metadata you must create a file resource using the create file resource function.

    What format are you receiving the image from in your external API request response? I'm curious why you are trying to transform it to a base64 file before adding it to the database, could be unnecessary especially if you are already returning an image URL
  • Connor McCormick
    Options
    Thanks for the response ! 

    My intention is to do nothing more than to grab an image from a url and then store it. 

    How would you go about this. Is the linked video tutorial not the way?
  • Connor McCormick
    Options
    I guess I can just do this:
    [image.png]