pfeifferNet

Media
in package

Provides enhanced media functionality.

  • Provides a default image.
  • Provides image attribute data.
Tags
since
1.0.0
since
5.5.0

Inherit standard singleton class.

since
5.11.0

Deprecated global singleton.

used-by
Printing::__construct()
used-by
Media_Selector::__construct()
used-by
Term_Grid::__construct()

Table of Contents

Constants

FEATURED_IMAGE_DEFAULTS  = array('post_id' => 0, 'image_size' => 'big_prop')
Featured image url defaults.
IMAGE_ATTRIBUTE_DEFAULTS  = array('id' => 0, 'url' => '', 'alt' => '', 'caption' => '', 'description' => '', 'title' => '', 'srcset' => '', 'sizes' => '')
Image attribute defaults.

Properties

$fallback_image_id  : int
Default fallback image ID.
$instances  : array<string|int, object>
The array of instances of this class and sub-classes.

Methods

get_fallback_image_id()  : int
Get fallback image ID.
get_fallback_image_url()  : string
Get fallback image url.
get_featured_image_url()  : string
Return the featured image url.
get_image_attributes()  : array<string|int, mixed>
Get image attributes.
get_instance()  : object
Creates and/or returns the instance of this class.
__construct()  : void
Initialise the class.

Constants

Featured image url defaults.

protected array<string|int, mixed> FEATURED_IMAGE_DEFAULTS = array('post_id' => 0, 'image_size' => 'big_prop')

{ The defaults to use to retrieve featured image url. @type int $post_id The post id to search for featured image. @type string $image_size The default image size. }

Tags
since
5.7.0

IMAGE_ATTRIBUTE_DEFAULTS

Image attribute defaults.

protected array<string|int, mixed> IMAGE_ATTRIBUTE_DEFAULTS = array('id' => 0, 'url' => '', 'alt' => '', 'caption' => '', 'description' => '', 'title' => '', 'srcset' => '', 'sizes' => '')

{ The defaults to use for retrieved image attributes. @type int $id The attachment id. @type string $url The attachment permalink. @type string $alt The attachment alt text. @type string $caption The attachment caption. @type string $description The attachment description. @type string $title The attachment title attribute. @type string $srcset The attachment srcset attribute. @type string $sizes The attachment sizes attribute. }

Tags
since
5.8.0

Properties

$fallback_image_id

Default fallback image ID.

protected int $fallback_image_id = 0
Tags
since
6.3.0

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
5.11.0

Methods

Return the featured image url.

public get_featured_image_url([array<string|int, mixed> $args = array() ]) : string
Parameters
$args : array<string|int, mixed> = array()

The featured image url arguments.

Tags
since
5.7.0
see
Media::FEATURED_IMAGE_DEFAULTS
used-by
Printing::get_featured_image_url()
Return values
string

The featured image url.

get_image_attributes()

Get image attributes.

public get_image_attributes(int $image_id[, string $image_size = 'medium' ]) : array<string|int, mixed>
Parameters
$image_id : int

Attachment ID.

$image_size : string = 'medium'

Optional. Image size.

Tags
since
1.7.0
see
Media::IMAGE_ATTRIBUTE_DEFAULTS
Return values
array<string|int, mixed>

Array of image attributes.

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
5.11.0
Return values
object

The instance of this class.


        
On this page

Search results