src/classes/CCImage.php
public function add_layer( CCImage $image, $x = 0, $y = 0, $alpha = 100 ) 
	{
		// auto values
		if ( $x == 'center' || $x == 'auto' )
		{
			$x = ( $this->width / 2 ) - ( $image->width / 2 );
		}
		elseif ( $x == 'left' )
		{
			$x = 0;
		}
		elseif ( $x == 'right' )
		{
			$x = $this->width - $image->width;
		}

		if ( $y == 'middle' || $y == 'auto' )
		{
			$y = ( $this->height / 2 ) - ( $image->height / 2 );
		}
		elseif ( $x == 'top' )
		{
			$x = 0;
		}
		elseif ( $x == 'bottom' )
		{
			$x = $this->height - $image->height;
		}

		// run image copy
		imagecopymerge( $this->image_context, $image->image_context, $x, $y, 0, 0, $image->width, $image->height, $alpha );

		return $this;
	}
public function add_layer( CCImage $image, $x = 0, $y = 0, $alpha = 100 ) 
	{
		// auto values
		if ( $x == 'center' || $x == 'auto' )
		{
			$x = ( $this->width / 2 ) - ( $image->width / 2 );
		}
		elseif ( $x == 'left' )
		{
			$x = 0;
		}
		elseif ( $x == 'right' )
		{
			$x = $this->width - $image->width;
		}

		if ( $y == 'middle' || $y == 'auto' )
		{
			$y = ( $this->height / 2 ) - ( $image->height / 2 );
		}
		elseif ( $x == 'top' )
		{
			$x = 0;
		}
		elseif ( $x == 'bottom' )
		{
			$x = $this->height - $image->height;
		}

		// run image copy
		imagecopymerge( $this->image_context, $image->image_context, $x, $y, 0, 0, $image->width, $image->height, $alpha );

		return $this;
	}
public function add_layer ( CCImage $ image , $ x = 0 , $ y = 0 , $ alpha = 100 ) { // auto values if ( $ x == 'center' || $ x == 'auto' ) { $ x = ( $ this -> width / 2 ) - ( $ image -> width / 2 ) ; } elseif ( $ x == 'left' ) { $ x = 0 ; } elseif ( $ x == 'right' ) { $ x = $ this -> width - $ image -> width ; } if ( $ y == 'middle' || $ y == 'auto' ) { $ y = ( $ this -> height / 2 ) - ( $ image -> height / 2 ) ; } elseif ( $ x == 'top' ) { $ x = 0 ; } elseif ( $ x == 'bottom' ) { $ x = $ this -> height - $ image -> height ; } // run image copy imagecopymerge ( $ this -> image_context , $ image -> image_context , $ x , $ y , 0 , 0 , $ image -> width , $ image -> height , $ alpha ) ; return $ this ; }
add an layer to the current image

@param CCImage 		$image
@param int			$x
@param int			$y

@return self
add an layer to the current image