Scale size according to given constraints

@param  integer $height
@param  Closure $callback

@return Size
321088
private function resizeHeight($height, Closure $callback = null)
    {
        $constraint = $this->getConstraint($callback);

        if ($constraint->isFixed(Constraint::UPSIZE)) {
            $max_width = $constraint->getSize()->getWidth();
            $max_height = $constraint->getSize()->getHeight();
        }

        if (is_numeric($height)) {

            if ($constraint->isFixed(Constraint::UPSIZE)) {
                $this->height = ($height > $max_height) ? $max_height : $height;
            } else {
                $this->height = $height;
            }

            if ($constraint->isFixed(Constraint::ASPECTRATIO)) {
                $w = (int) round($this->height * $constraint->getSize()->getRatio());

                if ($constraint->isFixed(Constraint::UPSIZE)) {
                    $this->width = ($w > $max_width) ? $max_width : $w;
                } else {
                    $this->width = $w;
                }
            }
        }

        return $this;
    }
418683
public function wrap(Closure $callback, array $parameters = array())
    {
        return function () use ($callback, $parameters) {
            return $this->call($callback, $parameters);
        };
    }
339073
public function extend(Closure $callback = null)
    {
        !is_null($callback) && call_user_func($callback, $this->grid, $this->container->make('request'), $this->container->make('translator'));

        return $this;
    }
564521
public function resize($width, $height) {
        if (!$width) $width = 1;
        if (!$height) $height = 1;
        return (
            (false !== ($img = new gd(array($width, $height)))) &&
            $img->imagecopyresampled($this) &&
            (false !== ($this->image = $img->get_image())) &&
            (false !== ($this->width = $img->get_width())) &&
            (false !== ($this->height = $img->get_height()))
        );
    }
784610
public static function noConstraints(Closure $callback)
    {
        $previous = static::$constraints;

        static::$constraints = false;

        // When resetting the relation where clause, we want to shift the first element
        // off of the bindings, leaving only the constraints that the developers put
        // as "extra" on the relationships, and not original relation constraints.
        try {
            return call_user_func($callback);
        } finally {
            static::$constraints = $previous;
        }
    }
1032047
public function resize($width, $height, $allow_enlarge = false)
    {
        if (!$allow_enlarge) {
            // if the user hasn't explicitly allowed enlarging,
            // but either of the dimensions are larger then the original,
            // then just use original dimensions - this logic may need rethinking

            if ($width > $this->getSourceWidth() || $height > $this->getSourceHeight()) {
                $width  = $this->getSourceWidth();
                $height = $this->getSourceHeight();
            }
        }

        $this->source_x = 0;
        $this->source_y = 0;

        $this->dest_w = $width;
        $this->dest_h = $height;

        $this->source_w = $this->getSourceWidth();
        $this->source_h = $this->getSourceHeight();

        return $this;
    }
389088
public static function make(Closure $callback = null)
    {
        if ($callback instanceof Closure) {
            return $callback(new static(Security::create()));
        }

        return new static(Security::create());
    }
592281
private function get_size_by_fixed_height($new_height)
    {
        $ratio     = $this->width / $this->height;
        $new_width = $new_height * $ratio;

        return $new_width;
    }
1062105
public function scaleFixedHeight($height)
    {
        $_width = $this->do_getWidth();
        $_height = $this->do_getHeight();

        $width = (int)($_width * $height / $_height);
        $this->do_resize($width, $height);

        return $this;
    }
253342
public function scale(Int $width, Int $height = -1, String $mode = 'bilinearFixed') : GD
    {
        $this->canvas = imagescale($this->canvas, $width, $height, Helper::toConstant($mode, 'IMG_'));

        return $this;
    }
1357015
public function resize($width, $height, $ratio = false, $interlace = false) {

		if(false === ('-' . intval($width) == '-' . $width)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($width)), E_USER_ERROR);
		}

		if(false === ('-' . intval($height) == '-' . $height)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($height)), E_USER_ERROR);
		}

		if(null !== $ratio && false === is_bool($ratio)) {
			return trigger_error(sprintf('Argument 3 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($ratio)), E_USER_ERROR);
		}

		if(false === is_bool($interlace)) {
			return trigger_error(sprintf('Argument 4 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($interlace)), E_USER_ERROR);
		}

		$this -> add(__FUNCTION__, func_get_args());

		return $this;
	}
737215
public function croppedResize($width, $height)
    {
        return $this->createCloneWithResource(
            function (InterventionImage $resource) use ($width, $height) {
                return $resource->fit($width, $height);
            }
        );
    }
309754
public function scale($new_width = null, $new_height = null)
        {
            if(!is_null($new_width) && is_null($new_height))
                $new_height = $new_width * $this->height / $this->width;
            elseif(is_null($new_width) && !is_null($new_height))
                $new_width = $this->width / $this->height * $new_height;
            elseif(!is_null($new_width) && !is_null($new_height)) {
                if($this->width < $this->height)
                    $new_width = $this->width / $this->height * $new_height;
                else
                    $new_height = $new_width * $this->height / $this->width;
            } else
                return false;

            return $this->resize($new_width, $new_height);
        }
1081957
public function getPropWidth($height)
    {
        $ratio = (int) $height / $this->height;
        return $this->width * $ratio;
    }
761502
public function fit_to_height($height)
    {
        $aspect_ratio = $this->height / $this->width;
        $width = $height / $aspect_ratio;

        return $this->resize($width, $height);
    }
174198
public function max(?callable $callback = null)
    {
        return $this->reduce(function ($result, $value, $key) use ($callback) {
            if ($callback !== null) {
                $value = $callback($value, $key);
            }

            return ($result === null) || $value > $result ? $value : $result;
        });
    }
1236872
public function setHeight($height, $adjustWidth = false) {
		if ($adjustWidth && is_numeric($height)) {
			$this->_adjustDimensions('width', 'height', $height);
		}
		return $this->setAttribute('height', $height);
	}