/**
 * Returns the url to original image.
 * It will return a protected image is the option "protect_full_image" is set
 *
 * @return string
 */
function getFullImageURL()
{
    global $_zp_current_image;
    if (is_null($_zp_current_image)) {
        return false;
    }
    $outcome = getOption('protect_full_image');
    if ($outcome == 'No access') {
        return NULL;
    }
    if (isImageVideo()) {
        // Download, Protected View, and Unprotected access all allowed
        // Search for a high quality version of the video
        $album = $_zp_current_image->getAlbum();
        $folder = $album->getFolder();
        $video = $_zp_current_image->getFileName();
        $video = substr($video, 0, strrpos($video, '.'));
        foreach (array(".ogg", ".OGG", ".avi", ".AVI", ".wmv", ".WMV") as $ext) {
            if (file_exists(internalToFilesystem(ALBUM_FOLDER_SERVERPATH . $folder . "/" . $video . $ext))) {
                return ALBUM_FOLDER_WEBPATH . $folder . "/" . $video . $ext;
            }
        }
        return getUnprotectedImageURL();
    } else {
        if ($outcome == 'Unprotected') {
            return getUnprotectedImageURL();
        } else {
            return getProtectedImageURL();
        }
    }
}
/**
 * Returns the url to original image.
 * It will return a protected image is the option "protect_full_image" is set
 *
 * @param $image optional image object
 * @return string
 */
function getFullImageURL($image = NULL)
{
    global $_zp_current_image;
    if (is_null($image)) {
        $image = $_zp_current_image;
    }
    if (is_null($image)) {
        return false;
    }
    $outcome = getOption('protect_full_image');
    if ($outcome == 'No access') {
        return NULL;
    }
    if ($outcome == 'Unprotected') {
        return $image->getFullImageURL();
    } else {
        return getProtectedImageURL($image, $outcome);
    }
}
/**
 * Returns the url to original image.
 * It will return a protected image is the option "protect_full_image" is set
 *
 * @return string
 */
function getFullImageURL()
{
    global $_zp_current_image;
    if (is_null($_zp_current_image)) {
        return false;
    }
    $outcome = getOption('protect_full_image');
    if ($outcome == 'No access') {
        return null;
    }
    $url = getUnprotectedImageURL();
    if (is_valid_video($url)) {
        // Download, Protected View, and Unprotected access all allowed
        $album = $_zp_current_image->getAlbum();
        $folder = $album->getFolder();
        $original = checkVideoOriginal(getAlbumFolder() . $folder, $_zp_current_image->getFileName());
        if ($original) {
            return getAlbumFolder(WEBPATH) . $folder . "/" . $original;
        } else {
            return $url;
        }
    } else {
        // normal image
        if ($outcome == 'Unprotected') {
            return $url;
        } else {
            return getProtectedImageURL();
        }
    }
}