Preparing search index...

    Function saveRecipeImage

    • Saves a recipe image from cache to permanent storage

      Bounds the image with resizeImageToBound before copying it to permanent storage under a unique filename. The recipe name is sanitized and combined with a UUID, preserving the original file extension. Images that already fit the bound, or whose format cannot be re-encoded, are stored verbatim.

      Parameters

      • cacheFileUri: string

        URI of the temporary image file to move

      • recName: string

        Recipe name used to generate the filename

      Returns Promise<string>

      Promise resolving to the permanent image URI, or empty string on failure

      const tempImageUri = "file:///cache/temp-image.jpg";
      const savedUri = await saveRecipeImage(tempImageUri, "Chocolate Cake");
      // Returns: "file:///documents/Recipedia/chocolate_cake_<uuid>.jpg"