Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Move Text Using php

    Hi everyone, i have a signature generator site called http://gamesigs.co.uk and have been trying to come up with a way let users move the text around so it doesn't just have to be in the middle. If you have any suggestions please help me as i'm a php novice. Here is the source that i think needs altering.

    Code:
    //Calculate, the centre:
    for(;;){
    list($image_width, $image_height) = getimagesize($bgpic);
    list($left_x, , $right_x) = imagettfbbox($size, 0, $font, $name);
    $text_width = $right_x - $left_x;
    if($image_width > $text_width+5){
    break;
    }
    $size = $size - .5;
    if($size == 1){
    die('Script not responding to decreasing font size, in other words: try using less letters.');
    }
    }
    $padding = ($image_width - $text_width)/2;
    $textcolor = imagecolorresolve($im, $fontcolor['r'], $fontcolor['g'], $fontcolor['b']);
    $grey = imagecolorallocate($im, 128, 128, 128);
    if($shadow == 'y'){
    imagettftext($im, $size, 0, $padding+1, 77, $grey, $font, $name);
    }
    if($lines == 'y'){
    //imagettftext($im, $size, 0, $padding+1, 77, $grey, $font, $name);
    }
    imagettftext($im, $size, 0, $padding, 75, $textcolor, $font, $name);
    if($_GET['dl']){
    header('Content-Disposition: attachment; filename="sig.jpeg"');
    }
    header("Content-type: image/jpeg");
    imagegif($im);
    ?>
    Thanks a lot. Digi

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Instead of the hard-coded coordinates for the text like you have, allow user input there.

  • #3
    New Coder
    Join Date
    Jun 2006
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts
    how could i do that?

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Add options to the form (such as left, right, center, etc) and pass those options to your PHP script just like the other options are being passed to the script.

  • #5
    New Coder
    Join Date
    Jun 2006
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry to ask but could you please explain in more detail. where are the hard co ordinates
    Last edited by digi duck; 09-04-2006 at 10:57 AM.

  • #6
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    seems that the website isnt working

  • #7
    Regular Coder googleit's Avatar
    Join Date
    Jul 2006
    Location
    birmingham, uk
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yeah it says it cannot be found maybe this is just my comp?

  • #8
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    it loading now, but not making sigs

  • #9
    New Coder
    Join Date
    Jun 2006
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ye sorry about that i was messing around thrying to make it so that the image would create on a html page but i kept getting errors and forgot to change it back to the working script as i was so fustrated. It kept coming up with hundreds of random letters where the pic. should be. This is because it was reading it as html/text not jpeg. Whenever i put in the
    Code:
    header("Content-type: image/jpeg");
    so it reads it as jpeg it says headers already sent. No idea how to resolve this.

    Anyway ill return the script to it's working form.

    Thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •