how to make a php file transparent image

Asked

Viewed 74 times

0

good people and I have the following code

<?php
$text = "meu texto para add";

$my_img = imagecreate( 200, 80 ); //width & height

$background  = imagecolorallocate( $my_img, 0,   0,   255 );
$text_colour = imagecolorallocate( $my_img, 255, 255, 0 );
$line_colour = imagecolorallocate( $my_img, 128, 255, 0 );
imagestring( $my_img, 4, 30, 25, $text, $text_colour );
imagesetthickness ( $my_img, 5 );
imageline( $my_img, 30, 45, 165, 45, $line_colour );

header( "Content-type: image/png" );
imagepng( $my_img );
imagecolordeallocate( $line_color );
imagecolordeallocate( $text_color );
imagecolordeallocate( $background );
imagedestroy( $my_img );
?> 

the doubt is the following, I wish I could use an existing image and put it however it is a png with transparent background, and when clicking save instead save as . php (on the user’s side, right-click on the.php image and save as png instead of php), and leave this text above the image, with transparent background.

  • Your text doesn’t make any sense. It has how to [Dit] the question and write using correctly the scores and forming full prayers?

  • basically do something like this with php, link

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.