I have the following script I think is making a file download instead of displaying text. This script is requested from another file as a function. After it does this anything echoed is downloaded.
If there is no echo an empty PHP file is downloaded.
Could someone please help.
Script:
<?php
function stickerCreate($serial,$location){
ob_start();
$header_image = "Content-type: image/png";
header($header_image);
$imgPath = 'sticker.png';
$string = $serial;
$directory = "serial_write/".$string.".png";
$image = imagecreatefrompng($imgPath);
$color = imagecolorallocate($image, 0, 0, 0);
$font = 'arial.ttf';
$fontSize = 18;
$x = 300;
$y = 480;
imagettftext($image, $fontSize, 0, $x, $y, $color, $font, $location);
imagepng($image, $directory);
header_remove("Content-type");
ob_flush();
}
?>
I dont know if it is the header that is doing it or what.
Thanks
Robert