Amazon_S3_And_CloudFront::maybe_encode_get_image_tag PHP Method

maybe_encode_get_image_tag() public method

Maybe encode attachment URLs when retrieving the image tag
public maybe_encode_get_image_tag ( string $html, integer $id, string $alt, string $title, string $align, string $size ) : string
$html string
$id integer
$alt string
$title string
$align string
$size string
return string
    public function maybe_encode_get_image_tag($html, $id, $alt, $title, $align, $size)
    {
        if (!($s3object = $this->is_attachment_served_by_s3($id))) {
            // Not served by S3, return
            return $html;
        }
        preg_match('@\\ssrc=[\'\\"]([^\'\\"]*)[\'\\"]@', $html, $matches);
        if (!isset($matches[1])) {
            // Can't establish img src
            return $html;
        }
        $img_src = $matches[1];
        $new_img_src = $this->maybe_sign_intermediate_size($img_src, $id, $size, $s3object);
        $new_img_src = $this->encode_filename_in_path($new_img_src);
        return str_replace($img_src, $new_img_src, $html);
    }
Amazon_S3_And_CloudFront