15 $width = $this->
argument(0)->value();
16 $height = $this->
argument(1)->value();
17 $constraints = $this->
argument(2)->type(
'closure')->value();
20 $resized = $image->getSize()->resize($width, $height, $constraints);
23 $this->
modify($image, 0, 0, 0, 0, $resized->getWidth(), $resized->getHeight(), $image->getWidth(), $image->getHeight());
42 protected function modify($image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)
45 $modified = imagecreatetruecolor($dst_w, $dst_h);
48 $resource = $image->getCore();
51 $transIndex = imagecolortransparent($resource);
53 if ($transIndex != -1) {
54 $rgba = imagecolorsforindex($modified, $transIndex);
55 $transColor = imagecolorallocatealpha($modified, $rgba[
'red'], $rgba[
'green'], $rgba[
'blue'], 127);
56 imagefill($modified, 0, 0, $transColor);
57 imagecolortransparent($modified, $transColor);
59 imagealphablending($modified,
false);
60 imagesavealpha($modified,
true);
64 $result = imagecopyresampled(
78 $image->setCore($modified);