increasing font size in imagestring

Discussion in 'PHP' started by Cinta April, Apr 30, 2008.

  1. #1
    Hi how do I increase the font size in a image string function? I need the text to look at least like a heading in my image.
     
    Cinta April, Apr 30, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    Can you show us some code, wich function is used to create a text?
     
    EricBruggema, Apr 30, 2008 IP
  3. Cinta April

    Cinta April Banned

    Messages:
    262
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    it's the imagestring() function. How do I increase my font using this function?
     
    Cinta April, May 2, 2008 IP
  4. suraj4u

    suraj4u Well-Known Member

    Messages:
    514
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    120
    #4
    <?php
    // create a 100*30 image... Increase this U will get big and big
    $im = imagecreate(100, 30);

    // white background and blue text
    $bg = imagecolorallocate($im, 255, 255, 255);
    $textcolor = imagecolorallocate($im, 0, 0, 255);

    // write the string at the top left
    imagestring($im, 5, 0, 0, "Hello world!", $textcolor);

    // output the image
    header("Content-type: image/png");
    imagepng($im);
    ?>


    Tahken from : http://www.tufat.com/docs/php_manual/function.imagestring.html
     
    suraj4u, May 2, 2008 IP
  5. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #5
    @ Suraj,
    That won't increase the font-size. It will only increase the image size.

    @ Cinta
    the second parameter in the imagestring() function indicates the font-size.(See the 5 in bold red below)
    
    imagestring($im, [B][COLOR="Red"]5[/COLOR][/B], 0, 0, "Hello world!", $textcolor);
    
    Code (markup):
    I think it the max font size you can get is 7(or may be 8). Even if you enter 15 as font-size, you will get output of max size 7.
     
    rohan_shenoy, May 2, 2008 IP
  6. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #6
    use <font style="font-size:22 em">some text</font> in loop

    And you can increase font size to 200 like this

    Regards

    Alex
     
    kmap, May 2, 2008 IP
  7. Cinta April

    Cinta April Banned

    Messages:
    262
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    that's the main problem. i'm already using font 5 and my text is still small. how do i make the text bigger?
     
    Cinta April, May 3, 2008 IP