public function image(string $imageFile, array $attributes = null) : self
    {
        if ($this->validate and ! $imageFile) {
            throw new Exception("Open Graph: Invalid image URL (empty)");
        }

        if (strpos($imageFile, '://') === false and function_exists('asset')) {
            $imageFile = asset($imageFile);
        }

        if ($this->validate and ! filter_var($imageFile, FILTER_VALIDATE_URL)) {
            throw new Exception("Open Graph: Invalid image URL '{$imageFile}'");
        }

        $this->tags[] = $this->createTag('image', $imageFile);

        if ($attributes) {
            $valid = [
                'secure_url',
                'type',
                'width',
                'height',
            ];

            $this->attributes('image', $attributes, $valid);
        }

        return $this;
    }
public function image(string $imageFile, array $attributes = null) : self
    {
        if ($this->validate and ! $imageFile) {
            throw new Exception("Open Graph: Invalid image URL (empty)");
        }

        if (strpos($imageFile, '://') === false and function_exists('asset')) {
            $imageFile = asset($imageFile);
        }

        if ($this->validate and ! filter_var($imageFile, FILTER_VALIDATE_URL)) {
            throw new Exception("Open Graph: Invalid image URL '{$imageFile}'");
        }

        $this->tags[] = $this->createTag('image', $imageFile);

        if ($attributes) {
            $valid = [
                'secure_url',
                'type',
                'width',
                'height',
            ];

            $this->attributes('image', $attributes, $valid);
        }

        return $this;
    }
public function image ( string $ imageFile , array $ attributes = null ) : self { if ( $ this -> validate and ! $ imageFile ) { throw new Exception ( "Open Graph: Invalid image URL (empty)" ) ; } if ( strpos ( $ imageFile , '://' ) === false and function_exists ( 'asset' ) ) { $ imageFile = asset ( $ imageFile ) ; } if ( $ this -> validate and ! filter_var ( $ imageFile , FILTER_VALIDATE_URL ) ) { throw new Exception ( "Open Graph: Invalid image URL '{$imageFile}'" ) ; } $ this -> tags [ ] = $ this -> createTag ( 'image' , $ imageFile ) ; if ( $ attributes ) { $ valid = [ 'secure_url' , 'type' , 'width' , 'height' , ] ; $ this -> attributes ( 'image' , $ attributes , $ valid ) ; } return $ this ; }
Adds an image tag.
If the URL is relative it's converted to an absolute one.

@param  string     $imageFile  The URL of the image file
@param  array|null $attributes Array with additional attributes (pairs of name and value)
@return OpenGraph
Adds an image tag . If the URL is relative it s converted to an absolute one .