SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict Kokos's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Text aligning with imagettftext();

    How can I change the alignment of text I output to right or center?
    Greets

    Taking over the web one pixel at a time.
    Currently working @ CodeCreators

  2. #2
    SitePoint Addict Kokos's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No-one?

    Taking over the web one pixel at a time.
    Currently working @ CodeCreators

  3. #3
    Wadge! F4nat1c's Avatar
    Join Date
    Oct 2005
    Location
    South Wales, UK
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's based on co-ordinates. You can't specifically ask it to align left centre or right because it's an image, but you can align it using co-ordnates.

    See here.
    OMFG SitePoint ROXORZ TEH BIG ONE111!
    Wish you were invisible?

  4. #4
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You actually can't really choose a font alignment with imagettftext, what you can do is determine the size of the text that will be produced with imageftbbox and then align the x & y where you are going to place the text in the image.

    I've worked alot with it for www.writeonit.org where we let the user write on some images and the alignment part was a real pain Anyhow, if you have to align multilines text I'd suggest to split the text and do an imagettftext for each line.


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
  •