code/Controller/AssetAdminFile.php
protected function getInsertDimensions()
    {
        $width = $this->owner->getWidth();
        $height = $this->owner->getHeight();
        if (!$height || !$width) {
            return null;
        }

        $maxWidth = $this->owner->config()->get('insert_width');
        $maxHeight = $this->owner->config()->get('insert_height');

        // Within bounds
        if ($width < $maxWidth && $height < $maxHeight) {
            return [
                'width' => $width,
                'height' => $height,
            ];
        }

        // Check if sizing by height or width
        if (($width * $maxHeight) < ($height * $maxWidth)) {
            // Size by height
            return [
                'width' => intval(($width * $maxHeight) / $height + 0.5),
                'height' => $maxHeight,
            ];
        } else {
            // Size by width
            return [
                'width' => $maxWidth,
                'height' => intval(($height * $maxWidth) / $width + 0.5),
            ];
        }
    }
protected function getInsertDimensions()
    {
        $width = $this->owner->getWidth();
        $height = $this->owner->getHeight();
        if (!$height || !$width) {
            return null;
        }

        $maxWidth = $this->owner->config()->get('insert_width');
        $maxHeight = $this->owner->config()->get('insert_height');

        // Within bounds
        if ($width < $maxWidth && $height < $maxHeight) {
            return [
                'width' => $width,
                'height' => $height,
            ];
        }

        // Check if sizing by height or width
        if (($width * $maxHeight) < ($height * $maxWidth)) {
            // Size by height
            return [
                'width' => intval(($width * $maxHeight) / $height + 0.5),
                'height' => $maxHeight,
            ];
        } else {
            // Size by width
            return [
                'width' => $maxWidth,
                'height' => intval(($height * $maxWidth) / $width + 0.5),
            ];
        }
    }
protected function getInsertDimensions ( ) { $ width = $ this -> owner -> getWidth ( ) ; $ height = $ this -> owner -> getHeight ( ) ; if ( ! $ height || ! $ width ) { return null ; } $ maxWidth = $ this -> owner -> config ( ) -> get ( 'insert_width' ) ; $ maxHeight = $ this -> owner -> config ( ) -> get ( 'insert_height' ) ; // Within bounds if ( $ width < $ maxWidth && $ height < $ maxHeight ) { return [ 'width' => $ width , 'height' => $ height , ] ; } // Check if sizing by height or width if ( ( $ width * $ maxHeight ) < ( $ height * $ maxWidth ) ) { // Size by height return [ 'width' => intval ( ( $ width * $ maxHeight ) / $ height + 0.5 ) , 'height' => $ maxHeight , ] ; } else { // Size by width return [ 'width' => $ maxWidth , 'height' => intval ( ( $ height * $ maxWidth ) / $ width + 0.5 ) , ] ; } }
Get dimensions of this image sized within insert_width x insert_height

@return array|null
Get dimensions of this image sized within insert_width x insert_height