src/Application.php
public function humanFileSize($bytes, $decimals = 2)
    {
        /** @var string $sizeLetters Size shortcuts */
        $sizeLetters = 'BKBMBGBTBPB';
        $factor = (int)(floor((strlen($bytes) - 1) / 3));
        $sizeLetter = ($factor <= 0) ? substr($sizeLetters, 0, 1) : substr($sizeLetters, $factor * 2 - 1, 2);
        return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . $sizeLetter;
    }
public function humanFileSize($bytes, $decimals = 2)
    {
        /** @var string $sizeLetters Size shortcuts */
        $sizeLetters = 'BKBMBGBTBPB';
        $factor = (int)(floor((strlen($bytes) - 1) / 3));
        $sizeLetter = ($factor <= 0) ? substr($sizeLetters, 0, 1) : substr($sizeLetters, $factor * 2 - 1, 2);
        return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . $sizeLetter;
    }
public function humanFileSize ( $ bytes , $ decimals = 2 ) { /** @var string $sizeLetters Size shortcuts */ $ sizeLetters = 'BKBMBGBTBPB' ; $ factor = ( int ) ( floor ( ( strlen ( $ bytes ) - 1 ) / 3 ) ) ; $ sizeLetter = ( $ factor <= 0 ) ? substr ( $ sizeLetters , 0 , 1 ) : substr ( $ sizeLetters , $ factor * 2 - 1 , 2 ) ; return sprintf ( "%.{$decimals}f" , $ bytes / pow ( 1024 , $ factor ) ) . $ sizeLetter ; }
Function to form image size
@param int $bytes Bytes count
@param int $decimals Decimal part of number(count of numbers)
@return string Generated image size
Function to form image size