asked on
<?php
/* 24-bit PNG source image */
$src_image = 'image.png';
/* create new image from source image */
$im_base = @imagecreatefrompng($src_image);
$width = imagesx($im_base);
$height = imagesy($im_base);
/*
$drop_shadow = imagecreatetruecolor($width, $height);
$black = imagecolorallocate($drop_shadow, 0, 0, 0);
imagecolortransparent($drop_shadow, $black);
*/
/*
$transparent = imagecolorallocatealpha($img, 0,0,0, 127);
*/
/* alpha blending on
imagealphablending($drop_shadow, true);*/
/* save alphablending setting
imagesavealpha($drop_shadow, false); */
/* drop shadow text
$font = 'Banty.ttf';
$fontSize = 70; // points
$fontRotation = 0; // 0 degrees
$fontX = -5; // pixels
$fontY = 75; // pixels
$fontColor = imagecolorallocate($drop_shadow, 0xD6, 0xD6, 0xD6); // hex or RGB
$text = "Test";
*/
/* add text to image
imagettftext($drop_shadow, $fontSize, $fontRotation, $fontX, $fontY, $fontColor, $font, $text);
*/
/* add blur shadow
imagefilter($drop_shadow, IMG_FILTER_GAUSSIAN_BLUR);
imagefilter($drop_shadow, IMG_FILTER_GAUSSIAN_BLUR);
imagefilter($drop_shadow, IMG_FILTER_GAUSSIAN_BLUR);
*/
/*
imagecopymerge($im, $drop_shadow, 50, 50, 50, 50, $width, $height, 100);
imagecopyresampled($im, $drop_shadow, 0, 0, 0, 0, $width, $height, $width, $height);
*/
/* customize the text
$font = 'Banty.ttf';
$fontSize = 70; // points
$fontRotation = 0; // 0 degrees
$fontX = 1; // pixels
$fontY = 70; // pixels
$color = imagecolorallocate($im, 0xFF, 0xFF, 0xFF); // hex or RGB
$text = "Test";
*/
/* add text to image
@imagettftext($im_base, $fontSize, $fontRotation, $fontX, $fontY, $color, $font, $text);
*/
/* output image */
header('Content-type: image/png');
@imagepng($im_base);
/* empty the buffer */
@imagedestroy($im_base);
?>
image.png