Available on: Newspaper V11+
This api call is used to add a new thumbnail to the theme.
Usage:
<?php td_api_thumb::add( $id, $params_array ) ?>
Parameters:
$id (string) (required)
- the thumbnail id – the id has to be different from the ones used on the other thumbnails registered in theme
$params_array (array) (required)
- an array which contains the parameters of the thumbnail
Key name
|
Type
|
Description
|
---|---|---|
name | string | the thumbnail name |
width | integer | the thumbnail width in pixels |
height | integer | the thumbnail height in pixels |
crop | mixed | the cropping method (array, true or false), it is passed to the add_image_size() function, for more information check the following resources – function – extra |
post_format_icon_size | string | specify what play icon to load for video posts (small or normal) |
used_on | array | the locations on which thumb appears, it’s just an info and appears in Theme Panel -> Block Settings |
Examples:
In the following example we’ll add Thumbnail 300×150 , you can see how the code looks on plugin, ex:
td_api_thumb::add('td_300x150', array( 'name' => 'td_300x150', 'width' => 300, 'height' => 150, 'crop' => array('center', 'top'), 'post_format_icon_size' => 'normal', 'used_on' => array( 'Flex blocks 1, 2, 3, 4, 5' ), 'no_image_path' => TDC_URL_LEGACY . '/assets', 'b64_encoded' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADIAQMAAABoEU4WAAAAA1BMVEWurq51dlI4AAAAAXRSTlMmkutdmwAAAB5JREFUWMPtwTEBAAAAwiD7pzbEXmAAAAAAAAAAEBweeAABBpYptwAAAABJRU5ErkJggg==', ) );