image_make_intermediate_size()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
image_make_intermediate_size( string $file, int $width, int $height, bool|array $crop = false ): array|false
Описание
Возвращаемый массив содержит размер файла, ширину и высоту изображения. Фильтр 'image_make_intermediate_size' можно использовать, чтобы подключиться и изменить значения возвращаемого массива. Его единственный параметр — путь к изменённому файлу.
Оригинал (английский)
The returned array has the file size, the image width, and image height. The ‘image_make_intermediate_size’ filter can be used to hook in and change the values of the returned array. The only parameter is the resized file path.
Параметры
$file
string
обязательный
$width
int
обязательный
$height
int
обязательный
$crop
bool|array
необязательный
= false
Возвращаемое значение
array|false
Исходный код
wp-includes/media.php:697
function image_make_intermediate_size( $file, $width, $height, $crop = false ) {
if ( $width || $height ) {
$editor = wp_get_image_editor( $file );
if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) ) {
return false;
}
$resized_file = $editor->save();
if ( ! is_wp_error( $resized_file ) && $resized_file ) {
unset( $resized_file['path'] );
return $resized_file;
}
}
return false;
}
История изменений
| Версия | Описание |
|---|---|
| 2.5.0 | Introduced. |

