Random quotes with PHP
Filed in PHP on Jan.16, 2008
I wrote a quick program for displaying random quotes in my forum signatures
I share the code with you below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | // Random Quotes with PHP // Praveen - ninethsense // 16 January 2008 header("Content-type: image/png"); $file = file("quotes.txt"); $txt = $file[rand(1, count($file)-1)]; $txt = substr($txt,0,strlen($txt)-2); $im = imagecreate((strlen($txt)*8),15); $bgcolor = imagecolorallocate($im, 230, 230, 230); imagecolortransparent($im,$bgcolor); $col = imagecolorallocate($im, 0, 0, 0); imagestring($im, 2, 0, 0, $txt, $col); imagepng($im); imagedestroy($im); |
Here is the demo: (try refresh)
Related posts:























Leave a Reply
You must be logged in to post a comment.