function wppa_get_hires_url($id)
{
    // video? return the poster url
    if (wppa_is_video($id) || wppa_has_audio($id)) {
        $url = wppa_get_photo_url($id);
        $url = wppa_fix_poster_ext($url, $id);
        $temp = explode('?', $url);
        $url = $temp['0'];
        return $url;
    }
    // Try CDN
    if (wppa_cdn('front') && !wppa_too_old_for_cloud($id)) {
        switch (wppa_cdn('front')) {
            case 'cloudinary':
                $url = wppa_get_cloudinary_url($id);
                break;
            default:
                $url = '';
        }
        if ($url) {
            return $url;
        }
    }
    // Try the orientation corrected source url
    $source_path = wppa_get_o1_source_path($id);
    if (is_file($source_path)) {
        // The source file is only http reacheable when it is down from wp-content
        if (strpos($source_path, WPPA_CONTENT_PATH) !== false) {
            return str_replace(WPPA_CONTENT_PATH, WPPA_CONTENT_URL, $source_path);
        }
    }
    // Try the source url
    $source_path = wppa_get_source_path($id);
    if (is_file($source_path)) {
        // The source file is only http reacheable when it is down from ABSPATH
        if (strpos($source_path, WPPA_CONTENT_PATH) !== false) {
            return str_replace(WPPA_CONTENT_PATH, WPPA_CONTENT_URL, $source_path);
        }
    }
    // The medium res url
    $hires_url = wppa_get_photo_url($id);
    $temp = explode('?', $hires_url);
    return $temp['0'];
}
function wppa_get_hires_url($id)
{
    // video? return the poster url
    if (wppa_is_video($id) || wppa_has_audio($id)) {
        $url = wppa_get_photo_url($id);
        $url = wppa_fix_poster_ext($url, $id);
        $temp = explode('?', $url);
        $url = $temp['0'];
        return $url;
    }
    // Try CDN
    if (wppa_cdn('front') && !wppa_too_old_for_cloud($id)) {
        switch (wppa_cdn('front')) {
            case 'cloudinary':
                $url = wppa_get_cloudinary_url($id);
                break;
            default:
                $url = '';
        }
        if ($url) {
            return $url;
        }
    }
    // Try the source url
    $source_path = wppa_get_source_path($id);
    $wp_content = trim(str_replace(site_url(), '', content_url()), '/');
    if (is_file($source_path)) {
        $temp = explode($wp_content, $source_path);
        $hires_url = site_url() . '/' . $wp_content . $temp['1'];
    } else {
        $hires_url = wppa_get_photo_url($id);
    }
    $temp = explode('?', $hires_url);
    $hires_url = $temp['0'];
    return $hires_url;
}