/** * Scale image to fit into a size range. * Reduces to maximum size after possibly enlarging to minimum size. * Range maximum has higher priority. * For better resolution this method will first maximize and than minimize if both is needed. * @access public * @param integer $minWidth Minimum width * @param integer $minHeight Minimum height * @param integer $maxWidth Maximum width * @param integer $maxHeight Maximum height * @param boolean $interpolate Flag: use interpolation * @param integer $maxMegaPixel Maxiumum megapixels * @return object Processor object for chaining */ public function scaleToRange($minWidth, $minHeight, $maxWidth, $maxHeight, $interpolate, $maxMegaPixel = 50) { $width = $this->image->getWidth(); $height = $this->image->getHeight(); if ($width < $minWidth || $height < $minHeight) { return $this->scaleUpToLimit($minWidth, $minHeight, $interpolate, $maxMegaPixel); } else { if ($width > $maxWidth || $height > $maxHeight) { return $this->scaleDownToLimit($maxWidth, $maxHeight, $interpolate, $maxMegaPixel); } } return $this; }
/** * Makes the image smoother. * Applies a 9-cell convolution matrix where center pixel has the weight arg1 and others weight of 1.0. * The result is normalized by dividing the sum with arg1 + 8.0 (sum of the matrix). * Any float is accepted, large value (in practice: 2048 or more) = no change * @access public * @param integer $weight Level of smoothness * @return boolean */ public function smooth($weight) { return imagefilter($this->image->getResource(), IMG_FILTER_SMOOTH, $weight); }