Lines Matching full:this
25 $this->image = $this->loadImage($imagepath);
34 if (is_resource($this->image)) {
35 imagedestroy($this->image);
44 if ($this->extension !== 'jpeg') {
45 return $this;
47 return $this->rotate(ImageInfo::readExifOrientation($this->imagepath));
63 return $this;
67 $transparency = imagecolorallocatealpha($this->image, 0, 0, 0, 127);
69 // rotate (orientation 2 is a flip-only case and keeps $this->image)
70 $image = $this->image;
72 $image = imagerotate($this->image, 180, $transparency);
74 $image = imagerotate($this->image, -90, $transparency);
75 list($this->width, $this->height) = [$this->height, $this->width];
77 $image = imagerotate($this->image, 90, $transparency);
78 list($this->width, $this->height) = [$this->height, $this->width];
86 if ($image !== $this->image) {
87 $this->__destruct(); // destroy old image
88 $this->image = $image;
92 if ($this->extension == 'png' && function_exists('imagesavealpha')) {
93 imagealphablending($this->image, false);
94 imagesavealpha($this->image, true);
97 return $this;
106 … list($width, $height) = ImageInfo::boundingBox($this->width, $this->height, $width, $height);
107 $this->resizeOperation($width, $height);
108 return $this;
117 … list($this->width, $this->height, $offsetX, $offsetY) = $this->cropPosition($width, $height);
118 $this->resizeOperation($width, $height, $offsetX, $offsetY);
119 return $this;
132 $extension = $this->extension;
140 imagejpeg($this->image, $path, $this->options['quality']);
142 $saver($this->image, $path);
145 $this->__destruct();
162 $this->width = $info[0];
163 $this->height = $info[1];
166 $this->extension = image_type_to_extension($info[2], false);
167 $creator = 'imagecreatefrom' . $this->extension;
169 throw new Exception('Can not work with image format ' . $this->extension);
196 if (function_exists('imagecreatetruecolor') && $this->extension != 'gif') {
207 if ($this->extension == 'png' && function_exists('imagesavealpha')) {
213 if ($this->extension == 'gif') {
214 $this->keepGifTransparency($this->image, $canvas);
266 * Given the wanted final size, this calculates which exact area needs to be cut
289 $oldRatio = $this->width / $this->height;
295 $cropWidth = $this->width;
296 $cropHeight = (int)($this->width / $newRatio);
298 $cropWidth = (int)($this->height * $newRatio);
299 $cropHeight = $this->height;
303 $cropWidth = (int)($this->height * $newRatio);
304 $cropHeight = $this->height;
306 $cropWidth = $this->width;
307 $cropHeight = (int)($this->width / $newRatio);
312 $offsetX = (int)(($this->width - $cropWidth) / 2);
313 $offsetY = (int)(($this->height - $cropHeight) / 2);
329 $newimg = $this->createImage($toWidth, $toHeight);
336 $this->image,
343 $this->width,
344 $this->height
349 $this->image,
356 $this->width,
357 $this->height
362 $this->__destruct();
363 $this->image = $newimg;
364 $this->width = $toWidth;
365 $this->height = $toHeight;