Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can I see the picture in php.

Status
Not open for further replies.

digitalroamer

Programmer
Joined
Jan 4, 2005
Messages
6
Location
CA
<?
$id = imagecreate(100,100);
$red = imagecolorallocate($id,255,0,0);
imagefill($id,0,0,$red);
imagewbmp($id);
imagedestroy($id);
?>

it seems the format doesn't match. But the gd version2 doesn't support gif any more. What should I do to see the picture? Thanks.
 
I'd just output a PNG or a JPEG.

But you need to have the script output an appropriate header. See the online manual entry for imagecreate() for an example.

With all that, just point your browser at the script.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
oh, yes, you are right, I don't script a header since it always says a parse error when I write

header("Content-type : image/png");

is it because I configure wrong?

Thanks.
 
You must have the GD library installed in order to make this work.

Check it out with

Code:
<?php
echo phpinfo();
?>

... look for the "gd" under "configuration". "GD support" must be enabled.

IF you have GD installed/enabled then have a go at this example
Best Regards


Jakob :-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top