Results 1 to 4 of 4

Thread: [RESOLVED]Text over picture problem

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2004
    Posts
    60

    Resolved [RESOLVED]Text over picture problem

    I have been working on a script with some help. What I am trying to do is have 2 seperate values and post them in exact coords on an image. Like a watermark but in text. Here is what I have so far but I dont get any errors just a red X. Any help is appricated

    PHP Code:
    <?
    header('Content-Type: image/jpeg');
    $text1 = "12";
    $text2 = "43";

    $image  = imagecreatefromjpeg("water.jpg"); //read the image into memory for editing...
    $white = imagecolorallocate($image,255,255,255); //php.net/imagecolorallocate
    imagettftext($image,5, 0, 20, 20, $white, "../gillsans.ttf", $text1); //string 1
    imagettftext($image,5, 0, 20, 50, $white, "../gillsans.ttf", $text2); //string 2
    imagejpeg($image,'',60); //This outputs to browser....
    imagedestroy($image); //Remove image from memory
    ?>
    The image I am using is here:
    http://65.69.189.225/ftp/CoZ/pappy/water.jpg
    and the page i have the script on is here
    http://65.69.189.225/ftp/CoZ/pappy/new.php

    Thank you,
    PaPPy
    Last edited by PaPPy; Jul 4th, 2005 at 04:13 PM.

  2. #2
    Fanatic Member ALL's Avatar
    Join Date
    Jul 2004
    Location
    192.168.1.1
    Posts
    711

    Re: Text over picture problem

    you made one simple mistake!!!

    PHP Code:
    imagettftext($image,502020$white"../gillsans.ttf"$text1); //string 1 
    imagettftext($image,502050$white"../gillsans.ttf"$text2); //string 2 
    should be...
    PHP Code:
    imagettftext($image,502020$white"gillsans.ttf"$text1); //string 1 
    imagettftext($image,502050$white"gillsans.ttf"$text2); //string 2 
    you are telling it to go 2 directories up to find the font, but that is not where the font is stored.

    this is what that code will look like:

    http://www.tkforums.com/new.php
    Please support one of my projects?
    TKForums.com

    Web Forum
    JavaScript Wiki
    ________________________
    If somone helps you, please rate their post, by clicking the to rate their post

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2004
    Posts
    60

    Re: Text over picture problem

    Quote Originally Posted by ALL
    you made one simple mistake!!!

    PHP Code:
    imagettftext($image,502020$white"../gillsans.ttf"$text1); //string 1 
    imagettftext($image,502050$white"../gillsans.ttf"$text2); //string 2 
    should be...
    PHP Code:
    imagettftext($image,502020$white"gillsans.ttf"$text1); //string 1 
    imagettftext($image,502050$white"gillsans.ttf"$text2); //string 2 
    you are telling it to go 2 directories up to find the font, but that is not where the font is stored.

    this is what that code will look like:

    http://www.tkforums.com/new.php

    that is so strange cause i tried that before but i tried it again and it works!

  4. #4
    Fanatic Member ALL's Avatar
    Join Date
    Jul 2004
    Location
    192.168.1.1
    Posts
    711

    Re: [RESOLVED]Text over picture problem

    ya, i hate it when that stuff happens too!
    Please support one of my projects?
    TKForums.com

    Web Forum
    JavaScript Wiki
    ________________________
    If somone helps you, please rate their post, by clicking the to rate their post

Posting Permissions

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



Click Here to Expand Forum to Full Width