wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
image_make_intermediate_size › WordPress Function
Seit2.5.0
Veraltetn/v
› image_make_intermediate_size ( $file, $width, $height, $crop = false )
| Parameter: (4) |
|
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: |
Resizes an image to make a thumbnail or intermediate size.
The returned array has the file size, the image width, and image height. The {@see '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.Ähnliche Funktionen: image_get_intermediate_size, get_intermediate_image_sizes, image_resize, wp_make_link_relative, wp_image_matches_ratio
Quellcode
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;
}