/** * {@inheritdoc} */ public function compositeImage($image, $coordX, $coordY, $width = 0, $height = 0, $transparency = 0) { if (!is_object($image)) { $image = new Imanee($image, new GDResource()); } if (!$image instanceof \Imanee\Imanee) { throw new \Exception('Object not supported. It must be an instance of Imanee'); } if ($width and $height) { $dimensions = PixelMath::getBestFit($width, $height, $image->getWidth(), $image->getHeight()); $width = $dimensions['width']; $height = $dimensions['height']; } else { $width = $image->getWidth(); $height = $image->getHeight(); } /* TODO: implement pixel per pixel transparency */ return imagecopyresampled($this->getResource(), $image->getResource()->getResource(), $coordX, $coordY, 0, 0, $width, $height, $image->getWidth(), $image->getHeight()); }