PHP Class The_SEO_Framework\Generate_Image

Generates Image SEO data based on content.
Since: 2.7.1
Inheritance: extends Generate_Url
Show file Open project: sybrew/the-seo-framework

Public Properties

Property Type Description
$image_dimensions array Holds the image dimensions, if found.

Public Methods

Method Description
get_header_image ( boolean $set_og_dimensions = false ) : string Returns header image URL.
get_image ( string $post_id = '', array $args = [], boolean $escape = true ) : string Fetches og:image URL.
get_image_from_post_thumbnail ( array $args = [] ) : string | null Fetches image from post thumbnail.
get_image_from_woocommerce_gallery ( ) : array Fetches images id's from WooCommerce gallery
parse_image_args ( array $args = [], array $defaults = [], boolean $get_defaults = false ) : array Parse and sanitize image args.
parse_og_image ( integer $id, array $args = [] ) : string | empty Parses OG image to correct size.
reparse_image_args ( array $args = [] ) : array Reparses image args.
site_icon ( string $size = 'full', boolean $set_og_dimensions = false ) : string Fetches site icon brought in WordPress 4.3.0

Protected Methods

Method Description
__construct ( ) Constructor, loads parent constructor.

Method Details

__construct() protected method

Constructor, loads parent constructor.
protected __construct ( )

get_header_image() public method

Also sets image dimensions. Falls back to current post ID for index.
Since: 2.7.0
public get_header_image ( boolean $set_og_dimensions = false ) : string
$set_og_dimensions boolean Whether to set size for OG image. Always falls back to the current post ID.
return string The header image URL, not escaped.

get_image() public method

Fetches og:image URL.
Since: 2.5.2 Applies filters string the_seo_framework_og_image_after_featured
Since: 2.5.2 Applies filters string the_seo_framework_og_image_after_header
public get_image ( string $post_id = '', array $args = [], boolean $escape = true ) : string
$post_id string The post ID.
$args array The image arguments.
$escape boolean Whether to escape the image URL.
return string the image URL.

get_image_from_post_thumbnail() public method

Resizes the image between 1500px if bigger. Then it saves the image and Keeps dimensions relative.
Since: 2.3.0
public get_image_from_post_thumbnail ( array $args = [] ) : string | null
$args array Image arguments.
return string | null the image url.

parse_image_args() public method

Parse and sanitize image args.
Since: 2.5.0
Since: 2.0.1 Applies filters the_seo_framework_og_image_args : { @param string $image The image url @param mixed $size The image size @param bool $icon Fetch Image icon @param array $attr Image attributes @param array $disallowed Disallowed image types : { array ( string 'featured' string 'header' string 'icon' ) } } The image set in the filter will always be used as fallback
public parse_image_args ( array $args = [], array $defaults = [], boolean $get_defaults = false ) : array
$args array required The passed arguments.
$defaults array The default arguments.
$get_defaults boolean Return the default arguments. Ignoring $args.
return array $args parsed args.

parse_og_image() public method

Parses OG image to correct size.
Since: 2.5.0
public parse_og_image ( integer $id, array $args = [] ) : string | empty
$id integer The attachment ID.
$args array The image args
return string | empty Parsed image url or empty if already called

reparse_image_args() public method

Reparses image args.
Since: 2.6.6
public reparse_image_args ( array $args = [] ) : array
$args array required The passed arguments.
return array $args parsed args.

site_icon() public method

Fetches site icon brought in WordPress 4.3.0
Since: 2.2.1
public site_icon ( string $size = 'full', boolean $set_og_dimensions = false ) : string
$size string The icon size, accepts 'full' and pixel values.
$set_og_dimensions boolean Whether to set size for OG image. Always falls back to the current post ID.
return string URL site icon, not escaped.

Property Details

$image_dimensions public property

Holds the image dimensions, if found.
Since: 2.7.0
public array $image_dimensions
return array