Ask AI
Skip to main content

Get media files

Function: Get media files

This function allows you to retrieve one or more media files that have been previously uploaded to your application's media library. You provide the unique identifiers for the files you want, and the function will fetch them, making them available for further use in your application.

Input

  • Media IDs:
    • Description: A list of unique identifiers (text values) for the specific media files you wish to load from your media library.
    • Type: List of Text values
    • Required: Yes

Output

  • Result:
    • Description: This is the name of the variable where the retrieved media files will be stored. You can choose a custom name, or it will default to MEDIA_FILE.
    • Type: List of Files
    • Default Variable Name: MEDIA_FILE

Execution Flow

Real-Life Examples

Example 1: Loading a Single Profile Picture

Imagine you have a user profile page and you want to display the user's profile picture. You know the ID of this picture from your database.

  • Inputs:
    • Media IDs: ["profile_pic_12345"]
    • Result (Output Variable Name): UserProfileImage
  • Result: The function retrieves the image file associated with profile_pic_12345 from your media library. This image is then stored in a variable named UserProfileImage, which you can use to display the picture on the user's profile page.

You're building an e-commerce product page and need to load all images for a specific product to display them in a gallery. You have a list of image IDs for that product.

  • Inputs:
    • Media IDs: ["product_img_A", "product_img_B", "product_img_C"]
    • Result (Output Variable Name): ProductImages
  • Result: The function fetches all three image files (product_img_A, product_img_B, product_img_C) from your media library. These files are then stored as a list in the ProductImages variable, ready to be used in your product image gallery.

Example 3: Attempting to Load a Non-Existent Document

A user tries to access a document, but the ID they provided might be incorrect or the document was deleted.

  • Inputs:
    • Media IDs: ["report_Q4_2023", "invalid_doc_id_XYZ"]
    • Result (Output Variable Name): LoadedDocuments
  • Result: The function successfully retrieves report_Q4_2023. However, it logs an error message indicating that invalid_doc_id_XYZ could not be found in the media library. The LoadedDocuments variable will contain only the report_Q4_2023 file, and your application can display a message to the user about the missing document.