logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: PHP 5.1.4 + Apache 2.2.2 GD lib. problems
Author
Siron



Joined: 11 Jun 2006
Posts: 6
Location: Utah / California

PostPosted: Thu 22 Jun '06 2:29    Post subject: PHP 5.1.4 + Apache 2.2.2 GD lib. problems Reply with quote

I have managed to get everything working okay on my Windows XP box with PHP 5.1.4, Apache 2.2.2, and MySQL 4.1.2, but for some reason I can't get images to display even though I correctly included the GD library extension in the php.ini.

Code:
<?php
var_dump(gd_info());
?>


that returns:

Code:
array(12) { ["GD Version"]=>  string(27) "bundled (2.0.28 compatible)" ["FreeType Support"]=>  bool(true) ["FreeType Linkage"]=>  string(13) "with freetype" ["T1Lib Support"]=>  bool(true) ["GIF Read Support"]=>  bool(true) ["GIF Create Support"]=>  bool(true) ["JPG Support"]=>  bool(true) ["PNG Support"]=>  bool(true) ["WBMP Support"]=>  bool(true) ["XPM Support"]=>  bool(false) ["XBM Support"]=>  bool(true) ["JIS-mapped Japanese Font Support"]=>  bool(false) }


so it appears to be working fine, however when i load the example image:

Code:
<?
header('Content-type: image/png');

$img   = imagecreatetruecolor(65, 20);
$white = imagecolorallocate($img, 255, 255, 255);
$black = imagecolorallocate($img, 0, 0, 0);

imagefill($img, 0, 0, $white);
imagestring($img, 3, 6, 3, "test", $black);
imagepng($img, '', 75);
imagedestroy($img);
?>


it just shows the link as the image, nothing else.. any ideas?
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3046
Location: Hilversum, NL, EU

PostPosted: Thu 22 Jun '06 11:38    Post subject: Reply with quote

Looks a php issue.

When I change for example to a .gif picture, then it is working:

header('Content-type: image/gif');
...

imagegif($img, '', 75);

Better ask further in a php forum.

Steffen
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Thu 22 Jun '06 17:38    Post subject: Reply with quote

Code:

<?php
header ("Content-type: image/png");
$im = @ImageCreate (50, 100)
      or die ("Kann keinen neuen GD-Bild-Stream erzeugen");
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageString ($im, 1, 5, 5, "Ein Test-String", $text_color);
ImagePNG ($im);
?>
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3046
Location: Hilversum, NL, EU

PostPosted: Thu 22 Jun '06 18:06    Post subject: Reply with quote

You are great James, you example is working.

Steffen
Back to top
Siron



Joined: 11 Jun 2006
Posts: 6
Location: Utah / California

PostPosted: Sun 25 Jun '06 0:45    Post subject: Reply with quote

That's weird because the code I pasted works on my host's server Question

oh well, thanks for your help!
Back to top
Siron



Joined: 11 Jun 2006
Posts: 6
Location: Utah / California

PostPosted: Sun 25 Jun '06 1:53    Post subject: Reply with quote

found what was wrong

Code:
imagepng($img, '', 75);


those last 2 parameters shouldn't be there, should just be $img. dunno why it works on my host's server but nowhere else.
Back to top


Reply to topic   Topic: PHP 5.1.4 + Apache 2.2.2 GD lib. problems View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner