Dan822
New Member
- Sep 11, 2013
- 25
- 3
Hello there.
the header.php is widely used across fansites, and it is correctly functioning on my local machien, but not my cpanel server which leads me to believe there is some extra configuration required.
expected outcome:
Actual outcome:
Code used:
the header.php is widely used across fansites, and it is correctly functioning on my local machien, but not my cpanel server which leads me to believe there is some extra configuration required.
expected outcome:
Actual outcome:
Code used:
PHP:
<?php
function imagettftextoutline(&$im,$size,$angle,$x,$y,&$col,
&$outlinecol,$fontfile,$text,$width) {
for ($xc=$x-abs($width);$xc<=$x+abs($width);$xc++) {
for ($yc=$y-abs($width);$yc<=$y+abs($width);$yc++) {
$text1 = imagettftext($im,$size,$angle,$xc,$yc,-$outlinecol,$fontfile,$text);
}
}
$text2 = imagettftext($im,$size,$angle,$x,$y,-$col,$fontfile,$text);
}
header( "Content-type: image/png" );
$font = "volterb.ttf";
$text = htmlspecialchars($_GET["text"]);
$text = str_replace(">", ">", $text);
$text = strtoupper($text);
$fontsize = $_GET["size"];
$width = $_GET["width"];
$size = imagettfbbox($fontsize, 0, $font, $text);
$x = (abs($size[0] - $size[2])) + ($width*3);
$y = (abs($size[1] - $size[5])) + ($width*3);
$im = imagecreatetruecolor($x, $y);
imageantialias($im, false);
$transparent = imagecolorallocate($im, 255, 255, 254);
imagefill($im, 0, 0, $transparent);
imagecolortransparent($im, $transparent);
$left = $size[0] + ($width*2);
$bottom = ($width*2) + $fontsize;
$white = imagecolorallocate( $im, 0xFF, 0xFF, 0xFF );
$border = $_GET["colour"];
if ($border == 'green') {
$border = imagecolorallocate( $im, 0x96, 0xb3, 0x50 );
}
if ($border == 'blue') {
$border = imagecolorallocate( $im, 0x42, 0x78, 0xAB );
}
if ($border == 'red') {
$border = imagecolorallocate( $im, 0xB3, 0x58, 0x58 );
}
if ($border == 'biege') {
$border = imagecolorallocate( $im, 0xAC, 0xA3, 0x94 );
}
if ($border == 'black') {
$border = imagecolorallocate( $im, 0x53, 0x53, 0x53 );
}
imagettftextoutline($im,$fontsize,0,$left,$bottom,$white,$border,$font,$text,$width);
imagepng( $im );
imagedestroy( $im );
?>