Grafika\Gd\Editor::resizeExactHeight PHP Method

resizeExactHeight() public method

Resize image to exact height. Width is auto calculated. Useful for creating row of images with the same height.
public resizeExactHeight ( Image &$image, integer $newHeight ) : Editor
$image Image
$newHeight integer Height in pixels.
return Editor
    public function resizeExactHeight(&$image, $newHeight)
    {
        $width = $image->getWidth();
        $height = $image->getHeight();
        $ratio = $width / $height;
        $resizeHeight = $newHeight;
        $resizeWidth = $newHeight * $ratio;
        $this->_resize($image, $resizeWidth, $resizeHeight);
        return $this;
    }