+ Reply to Thread
Page 2 of 6 FirstFirst 1234 ... LastLast
Results 11 to 20 of 51

Thread: PHP:Tutorial - Getting to know GD

  1. #11
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20
    you can change the file the php script looks for by editing this line

    Code:
    $font 'font.ttf'//font file 
    change it to

    Code:
    $font 'font.TTF'//font file 

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #12
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    Yeah I did that too before but.. still Broken image link :S

  4. #13
    codyg is offline Newbie
    Join Date
    Dec 2006
    Posts
    1
    Rep Power
    0

    Thumbs up Thanks

    Thanks for this, exactly want i needed and VERY helpful

  5. #14
    major Guest
    thanks!!!
    just the thing i was looking for
    prozit.net/ilu/index.php?form=sidewinder
    prozit.net/merry/index.php?form=Dan

    but i have one little problem
    how can i place the text in the midlle
    or by pixels

    and how can i pu the text in an angle
    Last edited by major; 01-13-2007 at 02:04 AM.

  6. #15
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20
    Quote Originally Posted by major View Post
    but i have one little problem
    how can i place the text in the midlle
    or by pixels
    Well by following the tutorial you know that these lines account for the location of the text:

    Code:
    $size imagettfbbox($fontsize0$font$text);
    $dx = (imagesx($im)) - (abs($size[2]-$size[0])) - 20
    Code:
    imagesx($im
    is the width of the image and
    Code:
    abs($size[2]-$size[0]) 
    is the width of the font

    In theory taking half the width of the image, and then subtracting half the width of the string should give you centered text so try this

    Code:
    $dx = (imagesx($im)/2) - (abs($size[2]-$size[0])/2); 
    Quote Originally Posted by major View Post
    and how can i put the text in an angle
    Quote Originally Posted by Sidewinder
    The imagettftext requires 8 arguments which are the resource image, font size, the angle, x location, y location, font color, the actual font, and the string to be printed.
    By taking a look at the php manuals reference to the imagettftext [ PHP: imagettftext - Manual ]
    angle:

    The angle in degrees, with 0 degrees being left-to-right reading text. Higher values represent a counter-clockwise rotation. For example, a value of 90 would result in bottom-to-top reading text.
    There for to make the text on an angle
    You would do
    Code:
    imagettftext($im$size451512$color$font$text); 
    Where 45 is the angel degree.

    This code has not been tested

    hth

  7. #16
    major Guest
    it is writing
    <br />
    <b>Fatal error</b>: Call to undefined function: imagettfbbox() in <b>/home/labdan/domains/prozit.net/public_html/gd/in.php</b> on line <b>22</b><br />


    http://prozit.net/gd/in.php?text=sadsa
    ...
    how can i solve it
    and onther thing
    it is the same code for gif and jpg expet from changing image/gif
    and
    image.gif
    ?

  8. #17
    ConnorWilson is offline Newbie
    Join Date
    Jan 2007
    Posts
    4
    Rep Power
    0
    I never really understood GD, even though I'm pretty advanced at PHP. This cleared a lot of things up, thanks.

  9. #18
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20
    Quote Originally Posted by major View Post
    it is writing
    <br />
    <b>Fatal error</b>: Call to undefined function: imagettfbbox() in <b>/home/labdan/domains/prozit.net/public_html/gd/in.php</b> on line <b>22</b><br />


    http://prozit.net/gd/in.php?text=sadsa
    ...
    how can i solve it
    and onther thing
    it is the same code for gif and jpg expet from changing image/gif
    and
    image.gif
    ?
    Which part of the changed code is causing the error? And no, this code is only meant for png images, there are other functions you can use for gif's and jpg's such as imagecreatefromgif() or imagecreatefromjpeg() rather than imagecreatefromgif(). Although you have to change the functions the general code should remain the same.

    For more information on the GD functions take a look here PHP: gd_info - Manual

  10. #19
    kraam Guest
    cool thanks

  11. #20
    snailofsatan is offline Newbie
    Join Date
    May 2007
    Posts
    4
    Rep Power
    0
    hello! nice tutorial!! i was just wondering if you know how to wrap the text into a nice paragraph if the string is too long to fit onto the image?

    thankyou
    kev.

+ Reply to Thread
Page 2 of 6 FirstFirst 1234 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Similar Threads

  1. Help with a VB tutorial please.
    By brap in forum Visual Basic Programming
    Replies: 0
    Last Post: 09-15-2010, 09:58 AM
  2. MPI tutorial
    By A-U-C-C in forum C and C++
    Replies: 1
    Last Post: 05-07-2010, 09:03 AM
  3. PHP Tutorial
    By Xav in forum PHP Development
    Replies: 0
    Last Post: 04-09-2008, 01:13 PM
  4. Need Help With Tutorial
    By gszauer in forum Java Help
    Replies: 2
    Last Post: 02-22-2008, 10:06 AM
  5. Hello, New and need a tutorial.
    By Cageman in forum C and C++
    Replies: 4
    Last Post: 12-12-2007, 11:23 AM

Tags for this Thread

Bookmarks

Posting Permissions

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