Craft\ImagerVariable::base64Pixel PHP Method

base64Pixel() public method

Returns a base64 encoded transparent pixel. Useful for adding as src on img tags for validation when using srcset.
public base64Pixel ( $width = 1, $height = 1 ) : string
return string
    public function base64Pixel($width = 1, $height = 1)
    {
        return "data:image/svg+xml;charset=utf-8," . rawurlencode("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {$width} {$height}'/>");
    }