Overlay Image

<?php

/**
 * overlay_image
 *
 * Overlay a transparent image on top of another image.
 *
 * @version 0.2
 * @author Contributors at eXorithm
 * @link https://www.exorithm.com/algorithm/view/overlay_image Listing at eXorithm
 * @link https://www.exorithm.com/algorithm/history/overlay_image History at eXorithm
 * @license https://www.exorithm.com/home/show/license
 *
 * @param resource $base (GD image) 
 * @param resource $image (GD image) 
 * @return mixed
 */
function overlay_image($base=null,$image=null)
{
	$h = imagesy($image);
	$w = imagesx($image);
	
	imagealphablending($base, true);
	imagesavealpha($base, true);
	imagecopy($base, $image, 0, 0, 0, 0, $w, $h);
	return $base;
}

?>