I'm using the following example and function. If -- header("Content-type: image/gif");-- is in the page without the Filename in imagegif it works fine. If I add the Filename to image gif it returns with just the URL and no file. If I take out -- header("Content-type: image/gif");-- and still have the Filename I get a blank page.
I've tried just the Filename and the Filename from the root. Still nothing.
I'm trying to make a hard copy of the image.
<?
///Example
$str = "test";
$TC = array(255,255,255);
$BC = array(159, 180, 204);
imagegif(imagettfJustifytext($str,"assets/ARIALN.TTF",2, 64, 16,0,0,10,$TC,$BC), "test.gif");
///Function
function imagettfJustifytext($text, $font, $Justify, $W, $H, $X, $Y, $fsize, $color=array(0x0,0x0,0x0), $bgcolor=array(0xFF,0xFF,0xFF)){
$angle = 0;
$L_R_C = $Justify;
$_bx = imageTTFBbox($fsize,0,$font,$text);
$W = ($W==0)?abs($_bx[2]-$_bx[0]):$W;
$H = ($H==0)?abs($_bx[5]-$_bx[3]):$H;
$im = @imagecreate($W, $H)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, $bgcolor[0], $bgcolor[1], $bgcolor[2]);
$text_color = imagecolorallocate($im, $color[0], $color[1], $color[2]);
if($L_R_C == 0){ //Justify Left
imagettftext($im, $fsize, $angle, $X, $fsize, $text_color, $font, $text);
}elseif($L_R_C == 1){ //Justify Right
$s = split("[\n]+", $text);
$__H=0;
foreach($s as $key=>$val){
$_b = imageTTFBbox($fsize,0,$font,$val);
$_W = abs($_b[2]-$_b[0]);
$_X = $W-$_W;
$_H = abs($_b[5]-$_b[3]);
$__H += $_H;
imagettftext($im, $fsize, $angle, $_X, $__H, $text_color, $font, $val);
$__H += 6;
}
}
elseif($L_R_C == 2){ //Justify Center
$s = split("[\n]+", $text);
$__H=0;
foreach($s as $key=>$val){
$_b = imageTTFBbox($fsize,0,$font,$val);
$_W = abs($_b[2]-$_b[0]);
$_X = abs($W/2)-abs($_W/2);
$_H = abs($_b[5]-$_b[3]);
$__H += $_H;
imagettftext($im, $fsize, $angle, $_X, 12, $text_color, $font, $val);
$__H += 6;
}
}
return $im;
}
?>
I've also tried:
$str = "test";
header("Content-type: image/gif");
$TC = array(255,255,255);
$BC = array(159, 180, 204);
imagegif(imagettfJustifytext($str,"assets/ARIALN.TTF",2, 64, 16,0,0,10,$TC,$BC), "test.gif");
and:
$str = "test";
$TC = array(255,255,255);
$BC = array(159, 180, 204);
imagegif(imagettfJustifytext($str,"assets/ARIALN.TTF",2, 64, 16,0,0,10,$TC,$BC), "subdomains/community/httpdocs/test.gif");