예제 #1
0
파일: Scale.php 프로젝트: joadr/cms
 /**
  * Scales the image proportionally to a width
  *
  * @param int $width
  *
  * @throws \InvalidArgumentException
  * @return void
  */
 public function scaleToWidth($width)
 {
     if (!self::isValidImageDimension($width)) {
         throw new \InvalidArgumentException('Width and Height must be integer > 0.');
     }
     $height = (int) round($width / $this->image->getWidth() * $this->image->getHeight());
     $this->image->scaleToDimensions($width, $height);
 }