public/Get-RecipeImagePath.ps1

function Get-RecipeImagePath {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [int]$RecipeId
    )

    $row = Invoke-RecipeDbQuery -Query @"
SELECT ImageFileName
FROM Recipes
WHERE RecipeId = $RecipeId;
"@


    if (-not $row -or -not $row.ImageFileName) { return $null }

    $path = Join-Path (Get-RecipeImageFolder) $row.ImageFileName
    if (-not (Test-Path $path)) { return $null }

    $path
}