Amazon_S3_And_CloudFront::get_url_preview PHP Method

get_url_preview() public method

Generate a preview of the URL of files uploaded to S3
public get_url_preview ( boolean $escape = true, string $suffix = 'photo.jpg' ) : string
$escape boolean
$suffix string
return string
    function get_url_preview($escape = true, $suffix = 'photo.jpg')
    {
        $scheme = $this->get_s3_url_scheme();
        $bucket = $this->get_setting('bucket');
        $path = $this->maybe_update_cloudfront_path($this->get_file_prefix());
        $region = $this->get_setting('region');
        if (is_wp_error($region)) {
            $region = '';
        }
        $domain = $this->get_s3_url_domain($bucket, $region, null, array(), true);
        $url = $scheme . '://' . $domain . '/' . $path . $suffix;
        // Replace hyphens with non breaking hyphens for formatting
        if ($escape) {
            $url = str_replace('-', '‑', $url);
        }
        return $url;
    }
Amazon_S3_And_CloudFront