WPSEO_Image_Utils::get_file_size()public staticYoast 1.0

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() Yoast 19.6.1

public static function get_file_size( $image ) {
	if ( isset( $image['filesize'] ) ) {
		return $image['filesize'];

	// If the file size for the file is over our limit, we're going to go for a smaller version.
	// @todo Save the filesize to the image metadata.
	// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- If file size doesn't properly return, we'll not fail.
	return @filesize( self::get_absolute_path( $image['path'] ) );