Lines Matching defs:width
13 /** @var int width of the current image */
14 protected $width = 0;
97 list($this->width, $this->height) = [$this->height, $this->width];
100 list($this->width, $this->height) = [$this->height, $this->width];
125 public function resize($width, $height)
127 list($width, $height) = $this->boundingBox($width, $height);
128 $this->resizeOperation($width, $height);
136 public function crop($width, $height)
138 list($this->width, $this->height, $offsetX, $offsetY) = $this->cropPosition($width, $height);
139 $this->resizeOperation($width, $height, $offsetX, $offsetY);
183 $this->width = $info[0];
208 * @param int $width
213 protected function createImage($width, $height)
218 $canvas = @imagecreatetruecolor($width, $height);
221 $canvas = @imagecreate($width, $height);
290 * @param int $width width of the bounding box
292 * @return array (width, height)
295 protected function boundingBox($width, $height)
297 $width = $this->cleanDimension($width, $this->width);
300 if ($width == 0 && $height == 0) {
305 // adjust to match width
306 $height = round(($width * $this->height) / $this->width);
307 } else if (!$width) {
309 $width = round(($height * $this->width) / $this->height);
312 $scale = min($width / $this->width, $height / $this->height);
313 $width = $this->width * $scale;
317 return [$width, $height];
346 * @param int $width
351 protected function cropPosition($width, $height)
353 if ($width == 0 && $height == 0) {
358 $height = $width;
361 if (!$width) {
362 $width = $height;
366 $oldRatio = $this->width / $this->height;
367 $newRatio = $width / $height;
372 $cropWidth = $this->width;
373 $cropHeight = (int)($this->width / $newRatio);
383 $cropWidth = $this->width;
384 $cropHeight = (int)($this->width / $newRatio);
389 $offsetX = (int)(($this->width - $cropWidth) / 2);
398 * @param int $toWidth desired width
420 $this->width,
433 $this->width,
441 $this->width = $toWidth;