+ Reply to Thread
Results 1 to 3 of 3

Thread: Help with outputing a picture and text below it

  1. #1
    purpleflame's Avatar
    purpleflame is offline x10Hosting Member purpleflame is an unknown quantity at this point
    Join Date
    Dec 2008
    Posts
    17

    Help with outputing a picture and text below it

    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 Code:
    <?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($dest000127);
    $fg_color imagecolorallocate($dest10251153);
    imagefill($dest00$bg_color);
    imagecolortransparent($dest$bg_color);
    imagestring($dest40$sigpicy+1'Thanks to amberleigh718 for the sig! ^^'$fg_color);

    // Copy and merge
    imagecopymerge($dest$sigpic0000$sigpicx$sigpicy100);

    // Output and free from memory
    header('Content-Type: image/png');
    imagepng($dest);

    imagedestroy($dest);
    imagedestroy($sigpic);
    ?>
    Last edited by purpleflame; 02-07-2009 at 02:50 PM. Reason: Fixed the last errors, its working great now!

  2. #2
    VPmase's Avatar
    VPmase is offline x10 Elder VPmase is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Dixon, IL, USA
    Posts
    914

    Re: Help with outputing a picture and text below it

    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 Code:
    <img src="createsig.php" alt="" /><br />TEXT GOES HERE

  3. #3
    purpleflame's Avatar
    purpleflame is offline x10Hosting Member purpleflame is an unknown quantity at this point
    Join Date
    Dec 2008
    Posts
    17

    Re: Help with outputing a picture and text below it

    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 by purpleflame; 02-07-2009 at 02:52 PM. Reason: Figured out the error and how to find it in the future. ^^

+ Reply to Thread

Similar Threads

  1. Center Picture using CSS
    By sclewin in forum Programming Help
    Replies: 4
    Last Post: 07-22-2008, 05:04 PM
  2. some picture uploads fale
    By embanako in forum Free Hosting
    Replies: 3
    Last Post: 03-17-2008, 05:52 PM
  3. Earn 300 credits for find the text in the picture.
    By medphoenix in forum The Marketplace
    Replies: 19
    Last Post: 02-12-2008, 12:30 PM
  4. {req} Text Animation Picture
    By SEŅOR in forum The Marketplace
    Replies: 2
    Last Post: 04-30-2006, 04:33 PM
  5. |PS|*Blur text Tutorial*
    By |Born2Shoot| in forum Tutorials
    Replies: 7
    Last Post: 06-04-2005, 10:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers