WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Image_Editor_GD::multi_resize() public WP 3.5.0

Create multiple smaller images from a single source.

Attempts to create all sub-sizes and returns the meta data at the end. This may result in the server running out of resources. When it fails there may be few "orphaned" images left over as the meta data is never returned and saved.

As of 5.3.0 the preferred way to do this is with make_subsize(). It creates the new images one at a time and allows for the meta data to be saved after each new image is created.

Это метод класса: WP_Image_Editor_GD{}

Хуков нет.

Возвращает

Массив. An array of resized images' metadata by size.

Использование

$WP_Image_Editor_GD = new WP_Image_Editor_GD();
$WP_Image_Editor_GD->multi_resize( $sizes );
$sizes(массив) (обязательный)
An array of image size data arrays.

Either a height or width must be provided. If one of the two is set to null, the resize will maintain aspect ratio according to the source image.

  • size(массив)
    Array of height, width values, and whether to crop.

    • width(число)
      Image width. Optional if $height is specified.

    • height(число)
      Image height. Optional if $width is specified.

    • crop(true/false)
      Optional. Whether to crop the image.
      По умолчанию: false

Список изменений

С версии 3.5.0 Введена.

Код WP Image Editor GD::multi resize: wp-includes/class-wp-image-editor-gd.php WP 5.5.1

<?php
public function multi_resize( $sizes ) {
	$metadata = array();

	foreach ( $sizes as $size => $size_data ) {
		$meta = $this->make_subsize( $size_data );

		if ( ! is_wp_error( $meta ) ) {
			$metadata[ $size ] = $meta;
		}
	}

	return $metadata;
}