Evan's Code for Drawing Rotated Text

Rotated Text



CODE FOLLOWS

<?php
include('includes/header.php');
error_reporting(E_ALL);
$self basename(__FILE__);
?>

<h1>Evan's Code for Drawing Rotated Text</h1>

<!-- Show the generated image -->
<img src="rotated-text.php" alt="Rotated Text">

<br><br>

<ul>
    <li>You will need a font for this operation. You can find the font
        <a href="fonts/arial.ttf">here</a>.
    </li>
    <li>Create a font directory and put the font in it.</li>
    <li>Then change "Evan's World" to something else.</li>
</ul>

<hr><br>
CODE FOLLOWS
<br><br>

<?php
highlight_file
($self);

echo 
"<hr><br>SLAVE CODE FOLLOWS<br><br>";

highlight_file('rotated-text.php');

include(
'includes/footer.php');
?>



SLAVE CODE FOLLOWS

<?php
// === create background work area

// create a blank image that is 160 by 160 pixels in size
$image imagecreatetruecolor(160160);

// set a color RGB (238, 238, 238), which is GRAY
$gray imagecolorallocate($image238238238);

//  fill the entire image
imagefilledrectangle($image00160160$gray);

// set the foreground RGB color for the text
// ( 0, 51, 102) is a DARK BLUE
$color imagecolorallocate($image051102);

$font 'fonts/arial.ttf';
$str "Evan's World...";

// draw rotated text
imagettftext($image204515150$color$font$str);

// tell the server that a GIF image follows
header("Content-Type: image/gif");

// display the image
imagegif($image);

// destroy the image
imagedestroy($image);
?>