Click to See Complete Forum and Search --> : PHP 4.3.2 & GD library


The Chancer
07-18-2003, 07:29 AM
I am trying to get the GD functions working with PHP 4.3.2, I have copied enabled GD2 in the php.ini, yet when I am trying to create an image, all I get is a the broken image box...

I have looked at the manual for this, but it doesn't seem to make things any clearer. I have put the GD2 DLL in the system32 folder, but this doesn't seem to have had any effect.

I think I need to install further libraries for this...

Running Win2kPro
Apache as CGI
PHP 4.3.2

tsinka
07-18-2003, 07:42 AM
Hi,

please post the code, something might be wrong

The Chancer
07-18-2003, 07:44 AM
Shoulda said, but tried the code on 4.3.1 machine and no probs...

But here you go..


<?php
header("Content-type: image/jpeg");
$im = imagecreate(400,100);
$background = imagecolorallocate($im, 255,204,255);
$text = imagecolorallocate($im, 0,0,0);
// Replace path by your own font path
imagettftext($im, 20, 0, 1, 50, $text, "../../../../../winnt/fonts/LCALLIG.ttf","bob");
imagejpeg($im);
imagedestroy($im);
?>


Note: the path for the font is OK... no error given regarding that

tsinka
07-18-2003, 08:00 AM
Check if there are empty lines before or after the php tags. If there is any output before or after the php block in that script and you use it in an image tag like <img src="script.php"> you'll get a broken image.

The Chancer
07-18-2003, 08:10 AM
Already checked that - and there aren't any...

This script works - copied exactly to another system and it doesn't..

It is an install / setup / config issue...