code/extensions/ExtendedImage.php
public function generateMergedImage($padding, $bgImagePath, $overlayImagePath, $cacheFile){

				$bgImage = Injector::inst()->createWithArgs(Image::get_backend(), array(
					$bgImagePath
				));

				$ovImage = Injector::inst()->createWithArgs(Image::get_backend(), array(
					$overlayImagePath
				));

				$frontImage = $this->owner->generateFit($ovImage, ($bgImage->getWidth() - (2*$padding)), ($bgImage->getHeight() - (2*$padding)));
				$backend = $bgImage->merge($frontImage);
				if($backend){
					$backend->writeTo(Director::baseFolder()."/" . $cacheFile);
				}
		}
public function generateMergedImage($padding, $bgImagePath, $overlayImagePath, $cacheFile){

				$bgImage = Injector::inst()->createWithArgs(Image::get_backend(), array(
					$bgImagePath
				));

				$ovImage = Injector::inst()->createWithArgs(Image::get_backend(), array(
					$overlayImagePath
				));

				$frontImage = $this->owner->generateFit($ovImage, ($bgImage->getWidth() - (2*$padding)), ($bgImage->getHeight() - (2*$padding)));
				$backend = $bgImage->merge($frontImage);
				if($backend){
					$backend->writeTo(Director::baseFolder()."/" . $cacheFile);
				}
		}
public function generateMergedImage ( $ padding , $ bgImagePath , $ overlayImagePath , $ cacheFile ) { $ bgImage = Injector :: inst ( ) -> createWithArgs ( Image :: get_backend ( ) , array ( $ bgImagePath ) ) ; $ ovImage = Injector :: inst ( ) -> createWithArgs ( Image :: get_backend ( ) , array ( $ overlayImagePath ) ) ; $ frontImage = $ this -> owner -> generateFit ( $ ovImage , ( $ bgImage -> getWidth ( ) - ( 2 * $ padding ) ) , ( $ bgImage -> getHeight ( ) - ( 2 * $ padding ) ) ) ; $ backend = $ bgImage -> merge ( $ frontImage ) ; if ( $ backend ) { $ backend -> writeTo ( Director :: baseFolder ( ) . "/" . $ cacheFile ) ; } }
genereate the merged image
genereate the merged image