Hi, i have a similar script to this which i got free from a website, and i wanted to change the one i had previous to that so it was similar
here's the script.
<?php
function page_head($text_dis) {
if ($_GET['im'] == TRUE) {
header("Content-type: image/png");
$image = imagecreatefrompng("page-head-bg.png");
$font_size = 26;
$color = imagecolorallocate($image, 200,200,200);
$black = imagecolorallocate($image, 0,0,0);
imagettftext ($image, $font_size, 0, 10, 29, $black, "flatbn.ttf", $text_dis);
imagettftext ($image, $font_size, 0, 9, 28, $color, "flatbn.ttf", $text_dis);
imagepng($image);
exit();
}
}
?>
whats its meant to do is display a picture when page_load("Some Text"); is called then later <img src="?im=1"> is used
however this is not the case.
everytime i try to run this i get a white box with a red cross indicating the picture couldnt be found.
if i was to take away the if ($_GET['im']==TRUE) { statement and use the rest of the code on a seperate page it works.
eg.
<?php
header("Content-type: image/png");
$image = imagecreatefrompng("page-head-bg.png");
$font_size = 26;
$color = imagecolorallocate($image, 200,200,200);
$black = imagecolorallocate($image, 0,0,0);
imagettftext ($image, $font_size, 0, 10, 29, $black, "../fonts/flatbn.ttf", $_POST['text']);
imagettftext ($image, $font_size, 0, 9, 28, $color, "../fonts/flatbn.ttf", $_POST['text']);
imagepng($image);
imagedestroy($image);
?>
below is how i'm calling the function.
<?php
$fa -> page_head("Flash Animations");
$data = "<center><img src=\"".$_SERVER['PHP_SELF']."?im=1\"></center>";
$tpl -> set_var(DATA, $data);
$tpl -> parse("displayn", "display");
$tpl -> p("displayn");
?>
could someone please advice me to why this isn't working properly.
thanks, Jon