protected function getTargetDimensions($width, $height, $originalImagePath)
    {
        $originalDimensions = [$width, $height];

        try {
            $dimensions = getimagesize($originalImagePath);
            if (!$dimensions) {
                return $originalDimensions;
            }

            if ($dimensions[0] > $width || $dimensions[1] > $height) {
                return $originalDimensions;
            }

            return $dimensions;
        }
        catch (Exception $ex) {
            return $originalDimensions;
        }
    }
protected function getTargetDimensions($width, $height, $originalImagePath)
    {
        $originalDimensions = [$width, $height];

        try {
            $dimensions = getimagesize($originalImagePath);
            if (!$dimensions) {
                return $originalDimensions;
            }

            if ($dimensions[0] > $width || $dimensions[1] > $height) {
                return $originalDimensions;
            }

            return $dimensions;
        }
        catch (Exception $ex) {
            return $originalDimensions;
        }
    }
protected function getTargetDimensions ( $ width , $ height , $ originalImagePath ) { $ originalDimensions = [ $ width , $ height ] ; try { $ dimensions = getimagesize ( $ originalImagePath ) ; if ( ! $ dimensions ) { return $ originalDimensions ; } if ( $ dimensions [ 0 ] > $ width || $ dimensions [ 1 ] > $ height ) { return $ originalDimensions ; } return $ dimensions ; } catch ( Exception $ ex ) { return $ originalDimensions ; } }
Get target dimensions
@param int $width
@param int $height
@param string $originalImagePath
@return void
Get target dimensions