td_api_thumb::update_key

Available on: Newspaper V11+

This api call is used to update only one of the parameters of an existing thumbnail.

Usage:

<?php td_api_thumb::update_key( $id, $key, $value ) ?>

Parameters:

$id (string) (required)

  • the thumbnail id – has to match with one of the thumbnails which are already registered in the theme

$key (string) (required)

  • parameter to be replaced, in the following table you can see all parameters but only one can be used because via this method you can update only one parameter:
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 – functionextra
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

$value (mixed) (required)

  • the data which will replace the parameter existing one, it’s type depends on the selected parameter.

Examples:

In the following example we’ll update the existing Thumbnail 150×0 ,  the ‘crop’ key data will be replaced, you can see how the code looks on plugin, ex:

td_api_thumb::update_key('td_150x0', 'crop', true);