public/js/filemanager/include/php_image_magician.php
private function gd_apply_overlay($im, $type, $amount)
		#
		# Original Author:    Marc Hibbins
		# License:  Attribution-ShareAlike 3.0
		# Purpose:
		# Params in:
		# Params out:
		# Notes:
		#
	{
		$width = imagesx($im);
		$height = imagesy($im);
		$filter = imagecreatetruecolor($width, $height);

		imagealphablending($filter, false);
		imagesavealpha($filter, true);

		$transparent = imagecolorallocatealpha($filter, 255, 255, 255, 127);
		imagefilledrectangle($filter, 0, 0, $width, $height, $transparent);

		// *** Resize overlay
		$overlay = $this->filterOverlayPath . '/' . $type . '.png';
		$png = imagecreatefrompng($overlay);
		imagecopyresampled($filter, $png, 0, 0, 0, 0, $width, $height, imagesx($png), imagesy($png));

		$comp = imagecreatetruecolor($width, $height);
		imagecopy($comp, $im, 0, 0, 0, 0, $width, $height);
		imagecopy($comp, $filter, 0, 0, 0, 0, $width, $height);
		imagecopymerge($im, $comp, 0, 0, 0, 0, $width, $height, $amount);

		imagedestroy($comp);

		return $im;
	}
private function gd_apply_overlay($im, $type, $amount)
		#
		# Original Author:    Marc Hibbins
		# License:  Attribution-ShareAlike 3.0
		# Purpose:
		# Params in:
		# Params out:
		# Notes:
		#
	{
		$width = imagesx($im);
		$height = imagesy($im);
		$filter = imagecreatetruecolor($width, $height);

		imagealphablending($filter, false);
		imagesavealpha($filter, true);

		$transparent = imagecolorallocatealpha($filter, 255, 255, 255, 127);
		imagefilledrectangle($filter, 0, 0, $width, $height, $transparent);

		// *** Resize overlay
		$overlay = $this->filterOverlayPath . '/' . $type . '.png';
		$png = imagecreatefrompng($overlay);
		imagecopyresampled($filter, $png, 0, 0, 0, 0, $width, $height, imagesx($png), imagesy($png));

		$comp = imagecreatetruecolor($width, $height);
		imagecopy($comp, $im, 0, 0, 0, 0, $width, $height);
		imagecopy($comp, $filter, 0, 0, 0, 0, $width, $height);
		imagecopymerge($im, $comp, 0, 0, 0, 0, $width, $height, $amount);

		imagedestroy($comp);

		return $im;
	}
private function gd_apply_overlay ( $ im , $ type , $ amount ) # # Original Author:    Marc Hibbins # License:  Attribution-ShareAlike 3.0 # Purpose: # Params in: # Params out: # Notes: # { $ width = imagesx ( $ im ) ; $ height = imagesy ( $ im ) ; $ filter = imagecreatetruecolor ( $ width , $ height ) ; imagealphablending ( $ filter , false ) ; imagesavealpha ( $ filter , true ) ; $ transparent = imagecolorallocatealpha ( $ filter , 255 , 255 , 255 , 127 ) ; imagefilledrectangle ( $ filter , 0 , 0 , $ width , $ height , $ transparent ) ; // *** Resize overlay $ overlay = $ this -> filterOverlayPath . '/' . $ type . '.png' ; $ png = imagecreatefrompng ( $ overlay ) ; imagecopyresampled ( $ filter , $ png , 0 , 0 , 0 , 0 , $ width , $ height , imagesx ( $ png ) , imagesy ( $ png ) ) ; $ comp = imagecreatetruecolor ( $ width , $ height ) ; imagecopy ( $ comp , $ im , 0 , 0 , 0 , 0 , $ width , $ height ) ; imagecopy ( $ comp , $ filter , 0 , 0 , 0 , 0 , $ width , $ height ) ; imagecopymerge ( $ im , $ comp , 0 , 0 , 0 , 0 , $ width , $ height , $ amount ) ; imagedestroy ( $ comp ) ; return $ im ; }
Apply a PNG overlay
Apply a PNG overlay