Location: PHPKode > projects > Modular Site Manager > htdocs/tutorials/PHP-2.php
Ok, ever HATE having to make a seperate image for each and every content box? Don't wanna make it text, and just gotta have images? Here's your answer!<br />
<br />
You'll need GD, cuz thats how its done.<br />

here's the php<br />
<div class="code"><strong>CODE:</strong><br /><hr />
<? xhtml_highlight('<?php
$text = $_GET[\'text\'];
// Cut Function
function cut($str,$len) {
if (strlen($str) > $len) {
return substr($str,0,$len).\'...\';
} else {
return $str;
}
}
// Create The Image
header("Content-type: image/gif");
$bg = "vouksh.info/graphix/interface.gif";

$im = @imagecreatefromgif($bg);


$width = 18;
$font = 2;
$white = imagecolorallocate($im, "255", "255", "255");

$black = imagecolorallocate($im, "0", "0", "0");

imagestring($im, $font, 50, 6, cut($text, $width), $white);

imagegif($im);
imagedestroy($im);

?>'); ?></div>


its kinda obvious what each thing does. the $_GET part gets the text function from the URL


The header property tells the browser that it\'s really a gif file, not a php file, but the server parses it the same.
Return current item: Modular Site Manager