problem working with imagecreate

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
phazorRise
Forum Contributor
Posts: 134
Joined: Mon Dec 27, 2010 7:58 am

problem working with imagecreate

Post by phazorRise »

I'm using PHPTriad 2.2. I have a small program from http://php.net/manual/en/function.imagecreate.php .

Here is the code :

Code: Select all

<?php
header("Content-type:image/png");
$im=@imagecreate(110, 20)
    or die("Cannot Initialize new GD image stream");
$background_color=imagecolorallocate($im, 0, 0, 0);
$text_color=imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Text String",$text_color);
imagepng($im);
imagedestroy($im);
?>
But i'm getting output as URL of file on localhost.
What's the problem?
User avatar
phazorRise
Forum Contributor
Posts: 134
Joined: Mon Dec 27, 2010 7:58 am

Re: problem working with imagecreate

Post by phazorRise »

prensil wrote:I tried your example and it is working fine. Your code is able to generate an image. So, please check your php ini for gd library.

Thanks & Regards,
Prensil Technologies Pvt. Ltd.
php web development company
http://www.prensil.com
okay. i'll look at it. but what should be the neccessary settings for enabling image related function? Thank you !
Post Reply