note 103394 added to function.imagecopymerge
| From: | AngelIbaezHernandez at osu1 dot php dot net | Date: | Tue, 12 Apr 2011 02:31:12 +0000 |
| Subject: | note 103394 added to function.imagecopymerge | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178716@lists.php.net to get a copy of this message | ||
jpeg image to png with semi-transparent text over:
----------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<?php
$h = 200;
$w = 200;
//load JPEG from file (jpeg to png conversion in the function too)
$img1 = imagecreatefromjpeg( "cuadrados.jpg" ); $w =imagesx( $img1 ); $h = imagesy( $img1
);
//create new true color image
$img2 = imagecreatetruecolor( $w, $h );
//copy image 1 to image 2, as background
imagecopy( $img2, $img1, 0, 0, 0, 0, $w, $h );
//create new true color image
$img3 = imagecreatetruecolor( $w, $h );
$black = imagecolorallocate( $img3, 0, 0, 0 ); //black color
$blackM = imagecolorallocate( $img3, 0, 0, 1 );// black color modified (if you need use black color)
imagefill( $img3, 0, 0, $blackM);//fill image3 background whith black modified
imagecolortransparent( $img3, $blackM );//set black modified as transparent color ¡ transparent
background !
imagettftext( $img3, 28, -35, 70, 100, $black, "browa.ttf", 'sobretexto' );
//write text whit black color
imagecopymerge( $img2, $img3, 0, 0, 0, 0, $w, $h, 20 ); //merge image 3 whit image 2, alpha = 20
imagepng( $img2, "prueba2.jpg" ); //image2 save to file
//destroy images
imagedestroy( $img3 );
imagedestroy( $img2 );
imagedestroy( $img1 );
?>
<br>
<br>
<center><img src="prueba2.jpg"></center><!--show image-->
</body>
</html>
----
Server IP: 130.206.1.5
Probable Submitter: 95.214.61.80
----
Manual Page -- http://www.php.net/manual/en/function.imagecopymerge.php
Edit -- https://master.php.net/note/edit/103394
Del: integrated -- https://master.php.net/note/delete/103394/integrated
Del: useless -- https://master.php.net/note/delete/103394/useless
Del: bad code -- https://master.php.net/note/delete/103394/bad+code
Del: spam -- https://master.php.net/note/delete/103394/spam
Del: non-english -- https://master.php.net/note/delete/103394/non-english
Del: in docs -- https://master.php.net/note/delete/103394/in+docs
Del: other reasons-- https://master.php.net/note/delete/103394
Reject -- https://master.php.net/note/reject/103394
Search -- https://master.php.net/manage/user-notes.php