Web Analytics Made Easy -
StatCounter text overlay with gdlib - CodingForum

Announcement

Collapse
No announcement yet.

text overlay with gdlib

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • text overlay with gdlib

    I have this code that loads a png file. and inserts text using a specified font.

    My only problem is that the text is always yellow, regardless of how i try to set it.

    Anybody have any ideas?

    PHP Code:
    $im_size getimagesize($img); 
    $image_width $im_size[0]; 
    $image_height $im_size[1]; 

    $im imagecreatetruecolor($image_width$image_height); 

    $im2 imagecreatefromPNG($img); 

    imagecopy($im$im20000$image_width$image_height); 
    imagedestroy($im2); 

    $white imagecolorallocate($im000); 
    $black Imagecolorallocate($im255255255); 

    // Calculate text position 
    $bounding_box imagettfbbox($font_size0$font_file$text); 
    $horz_pos $image_width $bounding_box[2] - $bounding_box[0] - 25
    $vert_pos $image_height 25

    // Write the text to the image, using the drop shadow effect 
    imagettftext($im$font_size$angle$horz_pos$vert_pos$black$font_file$text); 
    $horz_pos -= 1
    $vert_pos -= 1
    imagettftext($im$font_size$angle$horz_pos$vert_pos$black$font_file$text); 
    $horz_pos -= 1
    $vert_pos -= 1
    imagettftext($im$font_size$angle$horz_pos$vert_pos$white$font_file$text); 
    ImageInterlace($imtrue); 

    // Create and then destroy the image (discussed in steps 5 and 6) 
    header("Content-type: image/png"); 
    imagePNG($im); 
    imagedestroy($im); 
    ?> 
    thanks!
Working...
X