angela_john Posted December 6, 2010 Share Posted December 6, 2010 hi i am searching a long time that how to underline the text in gd libarary. i use unicode example but its not working good. can some one help me Link to comment https://forums.phpfreaks.com/topic/220786-underline-the-text-using-gd-libarary/ Share on other sites More sharing options...
QuickOldCar Posted December 6, 2010 Share Posted December 6, 2010 My best advice would be to tell you use the function imageline(). And then link you to the manual. http://nl3.php.net/imageline Link to comment https://forums.phpfreaks.com/topic/220786-underline-the-text-using-gd-libarary/#findComment-1143481 Share on other sites More sharing options...
angela_john Posted December 6, 2010 Author Share Posted December 6, 2010 Hi Quick can you post a link of example, 2nd thing is if text is "you are so sweet" and sweet is underline. how can we determine in imageline xpoint and y point Link to comment https://forums.phpfreaks.com/topic/220786-underline-the-text-using-gd-libarary/#findComment-1143505 Share on other sites More sharing options...
QuickOldCar Posted December 6, 2010 Share Posted December 6, 2010 Here is the image and code <?php //<img src="quick-image.php" alt="you are so sweet " width="200" height="100"> $start_left_line = 30; $end_right_line = 160; $left_tilt = 45; $right_tilt = 45; $quick_img = imagecreate( 200, 100 ); $background = imagecolorallocate( $quick_img, 192, 255, 255 ); $text_color = imagecolorallocate( $quick_img, 238, 44, 44 ); $line_color = imagecolorallocate( $quick_img, 255, 246, 143 ); imagestring( $quick_img, 4, 30, 25, "you are so sweet", $text_color ); imagesetthickness ( $quick_img, 5 ); imageline( $quick_img, $start_left_line, $left_tilt, $end_right_line, $right_tilt, $line_color ); header( "Content-type: image/png" ); imagepng( $quick_img ); imagecolordeallocate( $line_color ); imagecolordeallocate( $text_color ); imagecolordeallocate( $background ); imagedestroy( $quick_img ); ?> If would like to see the result look here. http://dynaindex.com/quick-image Link to comment https://forums.phpfreaks.com/topic/220786-underline-the-text-using-gd-libarary/#findComment-1143727 Share on other sites More sharing options...
requinix Posted December 6, 2010 Share Posted December 6, 2010 If you use TTF fonts and imagettftext(), you can also use imagettfbbox to get the bounding box of the text. Add a bit of vertical spacing and you have the endpoints for your line. Link to comment https://forums.phpfreaks.com/topic/220786-underline-the-text-using-gd-libarary/#findComment-1143760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.