note 38744 deleted from ref.image by didou

From: Date: Mon, 05 Jan 2004 19:30:33 +0000
Subject: note 38744 deleted from ref.image by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-62965@lists.php.net to get a copy of this message
Note Submitter: spannme@hotmail.com.NOSPAM ---- A nice winamp plugin, that puts the currently playing songtitle into a pic, so that it can be used as a signature in forums, brought me on this idea, after i wanted to create a random signature when winamp is off. Author: http://www.matttt.nl/ Winamp Plugin: http://www.winamp.com/plugins/details.php?id=133663 the following part doesn't require the plugin, just a 'sig.txt' with the random signatures you want to be displayed <?php header ("Content-type: image/png"); /* default signature, if you want to use it. * i use it, to be displayed more often than * the random ones (change below), * or if something went wrong with the file */ $standartsig = 'My Standart Sig'; //file with your random sigs, one per line $sigfile = 'sig.txt'; //display standart sig? - change at will if (rand(0,10) <= 4) { $tmp = $standartsig;} else { //get a random line, to use as signature if (file_exists($sigfile)) { $array = file($sigfile); $anzahl = count($array) - 1; $tmp = trim($array[rand(0,$anzahl)]); if (strlen($tmp) <= 1) {$tmp = $standartsig;} //line not empty? } else {$tmp = $standartsig;} } /* create Picture -- or use echo($tmp); * but don't forget to change or remove the "header()" then */ $im = imagecreate (6*strlen($tmp),14); $background_color = imagecolorallocate ($im, 255, 255, 255); $background_color = imagecolortransparent($im,$background_color); $text_color = imagecolorallocate ($im, 0, 0, 0); imagestring ($im, 2, 0, 0, $tmp, $text_color); imagepng ($im); ?> if anyone has a better idea of how to create a transparent background, feel free to email me (just remove ".NOSPAM")

« previous php.notes (#62965) next »