WPSEO_Image_Utils::get_file_size
Get the image file size.
Метод класса: WPSEO_Image_Utils{}
Хуков нет.
Возвращает
int. The file size in bytes.
Использование
$result = WPSEO_Image_Utils::get_file_size( $image );
- $image(массив) (обязательный)
- An image array object.
Код WPSEO_Image_Utils::get_file_size() WPSEO Image Utils::get file size Yoast 27.4
public static function get_file_size( $image ) {
if ( isset( $image['filesize'] ) ) {
return $image['filesize'];
}
if ( ! isset( $image['path'] ) ) {
return 0;
}
// If the file size for the file is over our limit, we're going to go for a smaller version.
if ( function_exists( 'wp_filesize' ) ) {
return wp_filesize( self::get_absolute_path( $image['path'] ) );
}
return file_exists( $image['path'] ) ? (int) filesize( $image['path'] ) : 0;
}