how to make a php file into transparent image

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 question is as follows, I wanted to be able to use an existing image and put it however it is a transparent background png, and when I click save instead of saving as .php (by the user, right mouse button on top of the image.php and save as png instead of php), and leave that text over the image with transparent background.

    
asked by anonymous 11.06.2017 / 04:25

0 answers