VerticalText

Aus Programmers Guide

Wechseln zu: Navigation, Suche

Eine PHP-Funktion die vertikal einen Text schreibt, da dies noch nicht von css unterstützt wird

/**
 *	@name printverticalDate
 *	@desc This function writes a vertical timestamp
 *	@param $today timestamp reflects the required time
 *	$return null
 */
function printverticalDate($today,$width=20,$height=250){
	global $day,$mon; //Arrays die Tag und Monatsnamen beinhalten
 
	//create the Image
	$im = imagecreatetruecolor($width, $height);
 
	// reset the alphablending
	imagealphablending($im, false);
 
	// save the alphavalue
	imagesavealpha($im, true);
 
	// Create colors
	$trans = imagecolorallocatealpha($im, 255, 255, 255, 127); //transparent color
	$gray = imagecolorallocate($im, 100, 100, 100); //font color
 
	// Draw transparent background
	imagefilledrectangle($im, 0, 0, 19, 249, $trans);
 
	// Set the alphablending to true
	imagealphablending($im, true);
 
	// Write the text
	imagettftext($im, 11, 90, 16, 240, $gray, 'f/arial.ttf', $day[ date("N",$today) ].", der ".date("d",$today).". ".$mon[ date("n",$today) ]." ".date("Y",$today));
 
	//Output PNG
	header("Content-type: image/png");
 
	//Destroy Image-Handle
	imagepng($im);
	imagedestroy($im);
}
Persönliche Werkzeuge