ניסיתי ככה:
gd.php:
PHP קוד:
<?php
session_start();
function gd()
{
header ("Content-type: image/png");
$filename = 're.png';
$im = imagecreatefrompng($filename);
$RandSec = strtoupper(substr(md5(rand(1,999999)),0,6)); //Making the 6 Characters Security Code , using MD5 And Rand()
$_SESSION['icode'] = $RandSec;
$textcolor = imagecolorallocate($im,0,0,0); //White
imagestring($im, 6,10,4, $RandSec,$textcolor);
imagepng($im);
}
?>
index.php:
PHP קוד:
require("gd.php");
echo "<IMG SRC=".gd()." name=secimg>";
echo "test";
את התמונה עצמה זה מציג אבל מה שאחרי זה לא מציג.