roto
Terugkerende gebruiker
- Lid geworden
- 26 mei 2001
- Berichten
- 1.308
Ik heb de volgende code:
De pagina laat in alle brouwsers een niet het plaatje zien met daarin de tekst "Nog een test 123". Als ik de volgende onderdelen verwijder, dan werkt het wel.
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>QR-link</title>
</head>
<?php
//Maak een png plaatje met de naam van de gebruiker
function namePic($name1){
return Text2Image(150,40,'arial.ttf',$name1);
}
//Gebruik: Text2Image(<breete>, <hoogte>, <fontfile>, <tekst>, <voorgrondkleur>, <achtegrondkleur>)
function Text2Image($arg1 = 200,$arg2 = 20,$arg3,$arg4,$fgcol = array(000,000,000),$bgcol = array(255,255,255)){
if(!checkRequirements()){
return false;
}
header ('Content-type: image/png');
$text = $arg4;
$im = imagecreatetruecolor($arg1, $arg2);
$text_color = imagecolorallocate($im, $fgcol[0], $fgcol[1],$fgcol[2]);
$bgcolour = imagecolorallocate($im, $bgcol[0],$bgcol[1],$bgcol[2]);
imagecolortransparent($im, $bgcolour);
imagefill($im,0,0,$bgcolour);
$fontttf = imagettftext($im, 12, 0, 0, 15, $text_color, $arg3, $text);
imagepng($im);
imagedestroy($im);
return;
}
//Controleerd of gd2 beschikbaar is op server
function checkRequirements(){
if(function_exists('imagecreatetruecolor') && function_exists('imagettftext')){
return true;
}
}
print namePic('Nog een test 123');
?>
<body>
</body>
</html>
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>QR-link</title>
</head>
<body>
</body>
</html>