rendered paste body<?php
$width=1024;
$height=1024;
$widthn=8;
$widthh=10;
$fontsize=48;
$font = "ariblk.ttf";
//END config
$num=0;
$spacerw=$width/$widthh;
$spacerh=$height/$widthn;
$canvas = imagecreatetruecolor($width,$height);
$background_color = imagecolorallocate($canvas, 255, 255, 255);
imagefill($canvas, 0, 0, $background_color);
$text_color = imagecolorallocate($canvas, 0, 0, 0);
$red=imagecolorallocate($canvas, 255, 0, 0);
for($v=0; $v<$widthn; $v++)
{
for ($h=0; $h<$widthh; $h++)
{
$num++;
$offsetx = $h * $spacerw;
$offsety = $v * $spacerh;
//Draw a rectangle
imagerectangle ( $canvas , $offsetx , $offsety , $offsetx+$spacerw , $offsety+$spacerh , $text_color );
//add half the spacer width and height to the image
$offsetx=$offsetx+($spacerw/2);
$offsety=$offsety+($spacerh/2);
//now subtract half the ttf box width and height
$arr = imagettfbbox($fontsize, 0 , $font , $num );
$textsizex=$arr[2]-$arr[0];
$textsizey=$arr[1]-$arr[7];
$offsetx=$offsetx - ($textsizex/2);
$offsety=$offsety - ($textsizey/2);
$offsety=$offsety + $textsizey; // since it measures from the bottom left
imagettftext($canvas,$fontsize, 0, $offsetx, $offsety, $text_color, $font, $num);
//show the text bounding box
imagerectangle ( $canvas , $offsetx , $offsety-$textsizey , $offsetx+$textsizex , $offsety , $red );
}
}
header('Content-type: image/png');
imagepng($canvas);
imagedestroy($canvas);
?>