Add image sizes to the media size dropdown list.

@param array $sizes The existing sizes.

@return array
772203
public function addSizesToDropDownList($sizes)
    {
        $new = array();

        $data = $this->getData();
        foreach ($data as $slug => $props)
        {
            // If no 4th option, stop the loop.
            if ( !isset($props['media']) || false == $props['media'])
            {
                continue;
            }

            $new[$slug] = isset($props['mediaLabel']) ? $props['mediaLabel'] : Strings::labelizeSlug($slug);

            // Internationalize what has to be
            $new[$slug] = Strings::translate($new[$slug]);
        }

        return array_merge($sizes, $new);
    }
578818
public static function get_image_size($size)
    {
        $sizes = static::get_image_sizes();

        if (\is_string($size) && isset($sizes[ $size ])) {
            return $sizes[ $size ];
        }

        return false;
    }
398731
public static function get_image_sizes()
    {
        global $_wp_additional_image_sizes;

        $sizes = [];

        $dynamic_sizes = Size_Manager::get_dynamic_sizes();

        foreach (\get_intermediate_image_sizes() as $size) {
            if (\in_array($size, ['thumbnail', 'medium', 'medium_large', 'large'])) {
                $sizes[ $size ] = [
                    'width' => \get_option("{$size}_size_w"),
                    'height' => \get_option("{$size}_size_h"),
                    'crop' => (bool) \get_option("{$size}_crop"),
                    'generated_on_upload' => ! \in_array($size, $dynamic_sizes),
                ];
            }

            if (isset($_wp_additional_image_sizes[ $size ])) {
                $sizes[ $size ] = [
                    'width'  => $_wp_additional_image_sizes[ $size ]['width'],
                    'height' => $_wp_additional_image_sizes[ $size ]['height'],
                    'crop'   => $_wp_additional_image_sizes[ $size ]['crop'],
                    'generated_on_upload' => ! \in_array($size, $dynamic_sizes),
                ];
            }
        }

        return $sizes;
    }
492284
protected function getImageDimensions($type, $size)
	{
		$pathToImage = public_path($this->getImageConfig($type, $size, 'dir') . $this->$type);
		if (is_file($pathToImage) && file_exists($pathToImage))
		{
			list($width, $height) = getimagesize($pathToImage);
		}
		else
		{
			$width = $height = false;
		}
		return array($width, $height);
	}
1357284
function assetImageDimensions($height = null, $width = null) {
        $imageDimensions = [];
        if ($height) $imageDimensions['height'] = $height;
        if ($width) $imageDimensions['width'] = $width;
        if (count($imageDimensions)) $this->data['assetImageDimensions'] = $imageDimensions;
        return $this;
    }
418079
public function bootstrapSize($size = null)
    {
        $styles = ['sm', 'xs', 'lg'];
        foreach ($styles as $style) {
            $this->removeClass('btn-' . $style);
        }

        return is_null($size) ? $this : $this->class('btn-' . $size);
    }
1219868
public function addToDropDown(array $options)
    {
        foreach ($this->sizes as $slug => $props) {
            if ($props['label'] && ! isset($options[$slug])) {
                $options[$slug] = $props['label'];
            }
        }

        return $options;
    }
792565
public static function parseSize($size)
    {
        $height = null;
        $width = null;

        if (count((array) $size) == 2 || strpos($size, 'x')) {
            list($width, $height) = is_array($size) ? $size : explode('x', $size);
        } else {
            $size = (array) $size;
            $width = (int) $size[0];
        }

        return array($width,$height);
    }
301651
public static function getSize( $size )
    {
        $dim = [];
        if( is_array( $size ) )
        {
            $dim[ 'w' ] = $size[0];
            $dim[ 'h' ] = isset( $size[1] ) ? $size[1] : $size[0];
        }
        else
        {
            $dim[ 'w' ] = $size;
            $dim[ 'h' ] = null;
        }

        return $dim;
    }
158201
public static function toReadableSize($size)
    {
        switch (true) {
            case $size < 1024:
                return __dn('cake', '{0,number,integer} Byte', '{0,number,integer} Bytes', $size, $size);
            case round($size / 1024) < 1024:
                return __d('cake', '{0,number,#,###.##} KB', $size / 1024);
            case round($size / 1024 / 1024, 2) < 1024:
                return __d('cake', '{0,number,#,###.##} MB', $size / 1024 / 1024);
            case round($size / 1024 / 1024 / 1024, 2) < 1024:
                return __d('cake', '{0,number,#,###.##} GB', $size / 1024 / 1024 / 1024);
            default:
                return __d('cake', '{0,number,#,###.##} TB', $size / 1024 / 1024 / 1024 / 1024);
        }
    }
69697
public static function fileSize($size)
    {
        $units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB'];

        for ($i = 0; $size > 1024; $i++) {
            $size /= 1024;
        }

        return __('Size unit ' . $units[$i], round($size, 2));
    }
559443
public function setColumnWidths(array $widths)
    {
        $this->columnWidths = [];
        foreach ($widths as $index => $width) {
            $this->setColumnWidth($index, $width);
        }

        return $this;
    }
863848
private function getMaxSize(array $filterSetNames)
    {
        $maxWidth = $maxHeight = 0;

        foreach ($filterSetNames as $filterSetName) {
            list($width, $height) = $this->getSize($filterSetName);

            if ($width > $maxWidth) {
                $maxWidth = $width;
            }
            if ($height > $maxHeight) {
                $maxHeight = $height;
            }
        }

        return [$maxWidth, $maxHeight];
    }
188891
public function crop(Array $settings = []) : GD
    {
        $sets = 
        [
            'x'      => $settings['x']      ?? $this->x      ?? 0,
            'y'      => $settings['y']      ?? $this->y      ?? 0,
            'width'  => $settings['width']  ?? $this->width  ?? 100,
            'height' => $settings['height'] ?? $this->height ?? 0,

        ];

        $this->canvas = imagecrop($this->canvas, $sets);

        $this->defaultRevolvingVariables();
        
        return $this;
    }
135706
public static function fileSize($size, $decimals = 2)
    {
        $units = [
            'B', 'KB', 'MB',
            'GB', 'TB', 'PB',
            'EB', 'ZB', 'YB'
        ];

        if ($size < 0)
        {
            throw new Exceptions\Invalid('Undefined size!');
        }

        $log     = \log($size, 1024);
        $power   = \min(\floor($log), \count($units));
        $postfix = $units[$power > 0 ? $power : 0];

        while ($power > 0 && $power--)
        {
            $size /= 1024;
        }

        return Num::format($size, $decimals) . ' ' . $postfix;
    }
1270933
public function setControlSize(string $size)
    {
        $allowed_sizes = [
            'lg',
            'md',
            'sm',
            'xs'
        ];

        if (!in_array($size, $allowed_sizes)) {
            Throw new FormDesignerException(sprintf('Size "%s" is no valid controlsize. Allowed sizes are %s.', $size, implode(', ', $allowed_sizes)));
        }

        $this->control_size = $size;
    }
895223
private function setSize($size = null)
    {
        if ($size !== null) {
            $size = (int) $size;

            if ($size < 0) {
                throw new \RuntimeException('File size cannot be a negative value ! (size: ' . $size . ')');
            }
        }

        $this->size = $size;

        return $this;
    }