By: Jeff Hardy
Date: 2005-02-19
Time: 22:19
|
Header Issue
I have this code:
template:
<tr>
<td valign="top"><strong>Código de Segurança:<strong></td>
<td><img src="[onshow;script=../includes/image.inc.php;getob]"></td>
</tr>
|
image.inc.php:
<?php
# Gera uma hash e tranforma em imagem, serve para impedir que haja
# gente a carregar no submit mais que uma vez.
include_once("sessao.inc.php");
include_once("password.inc.php");
$pass = passwd(4);
session_register("sessao_registo");
$sessao_registo = $pass;
header ("Content-type: image/png");
$im = imagecreate (40, 20);
$fundo = ImageColorAllocate ($im, 214, 228, 244);
$riscas = ImageColorAllocate ($im, 148, 185, 226);
$letras = ImageColorAllocate ($im, 0, 0, 0);
$BASimgcolor_grey = imagecolorallocate($im, 200, 200, 200);
$num1arcs = ($im + 3) ;
for ($i=1; $i<=$num1arcs; $i++) {
imagearc($im, -15+$i*30+rand(-20,20), 40+rand(-20,20), 96+rand(-20,20), 96+rand(-20,20), 0, 360, $riscas);
}
$num2arcs = ($BASnumimgchars + 3);
for ($i=1; $i<=$num2arcs; $i++) {
imagearc($im, -15+$i*30+rand(-20,20), 40+rand(-20,20), 96+rand(-20,20), 96+rand(-20,20), 0, 360, $BASimgcolor_grey);
}
ImageTTFText ($im, 10, 0, 5, 15, $letras, "verdana.ttf", $pass);
ImagePNG($im);
?>
|
I'm getting a broken image instead of the full page .. i think the problem is with that - header ("Content-type: image/png"); -
Without tinybutstrong i make a <? include "../images/image.inc.php"; ?> and it works fine.
Any idea?
Thanks ;)
|
By: Pirjo Posio
Date: 2005-02-20
Time: 07:20
|
Re: Header Issue
Hi Jeff,
I think it's a problem of path. You have in your template
<img src="[onshow;script=../includes/image.inc.php;getob]">
and in your include-version <? include "../images/image.inc.php"; ?>
- Pirjo
|