/** * Places an image on top of another image * In case you want to overlay transparent images, use PNGs only * * @param string $strImage The image to place into the loaded image * @param int $intX * @param int $intY * @param bool $bitCache * * @return bool */ public function overlayImage($strImage, $intX = 0, $intY = 0, $bitCache = false) { $bitReturn = false; //register for using the caching $this->strCacheAdd .= $strImage; //Cache? if ($bitCache) { //create cachename $this->strCachename = $this->generateCachename(); if (is_file(_realpath_ . $this->strCachepath . $this->strCachename)) { $this->bitNeedToSave = false; return true; } } $this->bitNeedToSave = true; //load image if ($this->objImage == null && $this->bitPreload) { $this->finalLoadImage(); } //load the other image into the system using another instance $objOverlayImage = new class_image(); if ($objOverlayImage->loadImage($strImage)) { imagealphablending($this->objImage, true); //merge pics $objOverlayResource = $objOverlayImage->getImageResource(); imagealphablending($objOverlayResource, true); $bitReturn = imagecopy($this->objImage, $objOverlayResource, $intX, $intY, 0, 0, $objOverlayImage->getIntWidth(), $objOverlayImage->getIntHeight()); //$bitReturn = imagecopymerge($this->objImage, $objOverlayResource, $intX, $intY, 0, 0, $objOverlayImage->getIntWidth(), $objOverlayImage->getIntHeight(), 100); } return $bitReturn; }