public function canvasImageScale()
    {
        $imageOriginalWidth = imagesx($this->oImg);
        $imageOriginalHeight = imagesy($this->oImg);
        $scale = min($imageOriginalWidth / $this->options ['width'], $imageOriginalHeight / $this->options ['height']);

        $this->options ['cropWidth'] = ceil($this->options ['width'] * $scale);
        $this->options ['cropHeight'] = ceil($this->options ['height'] * $scale);

        $this->options ['minScale'] = min($this->options ['maxScale'], max(1 / $scale, $this->options ['minScale']));

        if ($this->options ['prescale'] !== false)
        {
            $this->preScale = 1 / $scale / $this->options ['minScale'];
            if ($this->preScale < 1)
            {
                $this->canvasImageResample(ceil($imageOriginalWidth * $this->preScale), ceil($imageOriginalHeight * $this->preScale));
                $this->options ['cropWidth'] = ceil($this->options ['cropWidth'] * $this->preScale);
                $this->options ['cropHeight'] = ceil($this->options ['cropHeight'] * $this->preScale);
            }
            else
            {
                $this->preScale = 1;
            }
        }

        return $this;
    }
public function canvasImageScale()
    {
        $imageOriginalWidth = imagesx($this->oImg);
        $imageOriginalHeight = imagesy($this->oImg);
        $scale = min($imageOriginalWidth / $this->options ['width'], $imageOriginalHeight / $this->options ['height']);

        $this->options ['cropWidth'] = ceil($this->options ['width'] * $scale);
        $this->options ['cropHeight'] = ceil($this->options ['height'] * $scale);

        $this->options ['minScale'] = min($this->options ['maxScale'], max(1 / $scale, $this->options ['minScale']));

        if ($this->options ['prescale'] !== false)
        {
            $this->preScale = 1 / $scale / $this->options ['minScale'];
            if ($this->preScale < 1)
            {
                $this->canvasImageResample(ceil($imageOriginalWidth * $this->preScale), ceil($imageOriginalHeight * $this->preScale));
                $this->options ['cropWidth'] = ceil($this->options ['cropWidth'] * $this->preScale);
                $this->options ['cropHeight'] = ceil($this->options ['cropHeight'] * $this->preScale);
            }
            else
            {
                $this->preScale = 1;
            }
        }

        return $this;
    }
public function canvasImageScale ( ) { $ imageOriginalWidth = imagesx ( $ this -> oImg ) ; $ imageOriginalHeight = imagesy ( $ this -> oImg ) ; $ scale = min ( $ imageOriginalWidth / $ this -> options [ 'width' ] , $ imageOriginalHeight / $ this -> options [ 'height' ] ) ; $ this -> options [ 'cropWidth' ] = ceil ( $ this -> options [ 'width' ] * $ scale ) ; $ this -> options [ 'cropHeight' ] = ceil ( $ this -> options [ 'height' ] * $ scale ) ; $ this -> options [ 'minScale' ] = min ( $ this -> options [ 'maxScale' ] , max ( 1 / $ scale , $ this -> options [ 'minScale' ] ) ) ; if ( $ this -> options [ 'prescale' ] !== false ) { $ this -> preScale = 1 / $ scale / $ this -> options [ 'minScale' ] ; if ( $ this -> preScale < 1 ) { $ this -> canvasImageResample ( ceil ( $ imageOriginalWidth * $ this -> preScale ) , ceil ( $ imageOriginalHeight * $ this -> preScale ) ) ; $ this -> options [ 'cropWidth' ] = ceil ( $ this -> options [ 'cropWidth' ] * $ this -> preScale ) ; $ this -> options [ 'cropHeight' ] = ceil ( $ this -> options [ 'cropHeight' ] * $ this -> preScale ) ; } else { $ this -> preScale = 1 ; } } return $ this ; }
Scale the image before smartcrop analyse

@return \App\Helpers\Classes\SmartClass
Scale the image before smartcrop analyse