note 27287 added to function.imagecopy

From: Date: Sat, 30 Nov 2002 18:56:26 +0000
Subject: note 27287 added to function.imagecopy
Groups: php.notes 
Request: Send a blank email to php-notes+get-40188@lists.php.net to get a copy of this message
If you want to copy a non-rectangular (hence transparent) image onto a background (for example, a pawn onto a chessboard) do the following: First, create the pawn image pawn.png in your favorite graphics program. Do NOT make the image transparent, instead, give it a distinct solid background color. You will flag this color as transpernt inside PHP, otherwise imagecopy will not honor the transparency. Then: $board = imagecreatefrompng ("board.png"); $pawn = imagecreatefrompng ("pawn.png"); imagecolortransparent ($pawn, imagecolorat ($pawn, 0, 0)); imagecopy ($board, $pawn, $x, $y, 0, 0, $pawnWidth, $pawnHeight); imagedestroy ($pawn); -- http://www.php.net/manual/en/function.imagecopy.php http://master.php.net/manage/user-notes.php?action=edit+27287 http://master.php.net/manage/user-notes.php?action=delete+27287 http://master.php.net/manage/user-notes.php?action=reject+27287

« previous php.notes (#40188) next »