purpleflame
New Member
- Messages
- 17
- Reaction score
- 0
- Points
- 0
So I am working on a dynamic signature in which I choose a random picture and display it. This I can do, however, I would also like to add some text below the picture with a transparent background that gives credit to the user the made the signature for me. It is the latter part the I am stuck on. So to start off I just chose one of the pictures and tried to use that to make the script do what I want. From there I can add in the code for choosing which picture and the corresponding text. I have tried the code below, but only see a blank page when I run it from my browser (FireFox). Any help is appreciated. Thank you!
PHP:
<?php
// Create image instance for the signature picture to copy.
$sigpic = imagecreatefrompng('http://i271.photobucket.com/albums/jj149/violetvalor/sigs/7.png');
// Get the signature picture's size.
$sigpicx = imagesx($sigpic);
$sigpicy = imagesy($sigpic);
// Make a transparent picture with credit text and size based on the signature picture.
$dest = imagecreatetruecolor($sigpicx, $sigpicy+20);
$bg_color = imagecolorallocatealpha($dest, 0, 0, 0, 127);
$fg_color = imagecolorallocate($dest, 102, 51, 153);
imagefill($dest, 0, 0, $bg_color);
imagecolortransparent($dest, $bg_color);
imagestring($dest, 4, 0, $sigpicy+1, 'Thanks to amberleigh718 for the sig! ^^', $fg_color);
// Copy and merge
imagecopymerge($dest, $sigpic, 0, 0, 0, 0, $sigpicx, $sigpicy, 100);
// Output and free from memory
header('Content-Type: image/png');
imagepng($dest);
imagedestroy($dest);
imagedestroy($sigpic);
?>
Last edited: