adam84 Posted September 24, 2010 Share Posted September 24, 2010 I want to add some text onto an image. Sometimes I either get nothing returned or I get a shit load of garbage returned. Garbage in the form of little question mark symbols and other crap like that. PHP File - show Tickets include("createImage.php"); while( $row = mysql_fetch_array( $r ) ){ echo generateTicket( $row['ticketNumber'] ) . "<br /><br />"; } PHP - createImage.php <? header("Content-type: image/jpeg"); function generateTicket( $ticketNum ){ $imageFile = "images/ticket.jpeg"; if( file_exists( $imageFile ) ){ $im = @imagecreatefromjpg( $imageFile ); $text_color = imagecolorallocate( $im, 0, 0, 0 ); imagestring( $im, 6, 25, 150, $ticketNum, $text_color ); imagejpeg( $im ); }else echo 'error'; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.