Help with outputing a picture and text below it

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:

VPmase

New Member
Messages
914
Reaction score
0
Points
0
What you can do is save that php file separately and then use it as an img src then put the text below it. I.E. Filename: createsig.php

HTML:
<img src="createsig.php" alt="" /><br />TEXT GOES HERE
 

purpleflame

New Member
Messages
17
Reaction score
0
Points
0
When I made other scripts that output an image, I was able to see the image just fine by having the browser goto the script's location. I had no need to make another page to display the image. Regardless, I shall be doing that in the end. So below is the link to a test webpage I made and the script itself, respectively.

http://purpleflame.exofire.net/phptests/mergeImage.html
http://purpleflame.exofire.net/phptests/mergeImage.php

On the webpage, it just shows the image as a broken image. I simply cannot see what is wrong with my script. =(

__Edit__

I feel stupid (* '.' *). I finally figured out how to look at the error logs and found out that I misstyped some function names. I will be looking there before I rush here with this sort of issue again! <(^^)>
 
Last edited:
Top