Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




image_make_intermediate_size [ WordPress Function ]

image_make_intermediate_size ( $file, $width, $height, $crop = false )
Parameters:
  • (string) $file File path.
  • (int) $width Image width.
  • (int) $height Image height.
  • (bool) $crop Optional, default is false. Whether to crop image to specified height and width or resize.
Returns:
  • (bool|array) False, if no image was created. Metadata array on success.
Defined at:



Resize an image to make a thumbnail or intermediate size.

The returned array has the file size, the image width, and image height. The filter 'image_make_intermediate_size' can be used to hook in and change the values of the returned array. The only parameter is the resized file path.

Source


<?php
function image_make_intermediate_size($file$width$height$crop=false) {
    if ( 
$width || $height ) {
        
$resized_file image_resize($file$width$height$crop);
        if ( !
is_wp_error($resized_file) && $resized_file && $info getimagesize($resized_file) ) {
            
$resized_file apply_filters('image_make_intermediate_size'$resized_file);
            return array(
                
'file' => wp_basename$resized_file ),
                
'width' => $info[0],
                
'height' => $info[1],
            );
        }
    }
    return 
false;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics