ahmed17 Posted September 7, 2006 Share Posted September 7, 2006 very weird problem with gd libary all time and i try more but no wayi used phpinfo() method to ensure if gd libary setup or not and i am not found it installing and i ask somebody wat i do then i found php.ini (configuration) and i remove ; form gd then when i used phpinfo it appear but when i run any code no result appears [code]<?phpheader("Content-type: image/gif");$image= imagecreate(100,100)or die("Cannot Initialize new GD image stream");imagegif($im);?>[/code]gd with phpinfo()[img]http://ahmed17.xlphp.net/gd.gif[/img] Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/ Share on other sites More sharing options...
wildteen88 Posted September 7, 2006 Share Posted September 7, 2006 The code provided isnt the correct code AFAIK to create image with gd. Prehaps a have read of [url=http://www.design-ireland.net/graphics/imagery-15.php]this[/url] tutorial. That tutorial shows you how to create basics shapes with PHP GD. Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-87987 Share on other sites More sharing options...
ahmed17 Posted September 7, 2006 Author Share Posted September 7, 2006 i test the following code and take it copy and paste to ensure code is rigth but the result is [code]‰PNG [/code] the code ****************[code]<?php// example1.php// set the HTTP header type to PNGheader("Content-type: image/png");// set the width and height of the new image in pixels$width = 350;$height = 360;// create a pointer to a new true colour image$im = ImageCreateTrueColor($width, $height);// sets background to red$red = ImageColorAllocate($im, 255, 0, 0);ImageFillToBorder($im, 0, 0, $red, $red);// send the new PNG image to the browserImagePNG($im);// destroy the reference pointer to the image in memory to free up resourcesImageDestroy($im);?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88011 Share on other sites More sharing options...
Barand Posted September 7, 2006 Share Posted September 7, 2006 Looks fine - when I ran it I got a red square.Try putting this code on another page in the same folder<img src="example.php"> Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88018 Share on other sites More sharing options...
ahmed17 Posted September 7, 2006 Author Share Posted September 7, 2006 no result ..wat i do ? Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88029 Share on other sites More sharing options...
AndyB Posted September 8, 2006 Share Posted September 8, 2006 What does 'no result' mean? The script hung? You got a blank page? You got no image displayed? You got a 'missing' image displayed? Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88100 Share on other sites More sharing options...
ahmed17 Posted September 8, 2006 Author Share Posted September 8, 2006 when i run this code [code]<?php// example1.php// set the HTTP header type to PNGheader("Content-type: image/png");// set the width and height of the new image in pixels$width = 350;$height = 360;// create a pointer to a new true colour image$im = ImageCreateTrueColor($width, $height);// sets background to red$red = ImageColorAllocate($im, 255, 0, 0);ImageFillToBorder($im, 0, 0, $red, $red);// send the new PNG image to the browserImagePNG($im);// destroy the reference pointer to the image in memory to free up resourcesImageDestroy($im);?>[/code]the result of this code is [quote] ‰PNG [/quote] so no result clear Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88296 Share on other sites More sharing options...
AndyB Posted September 8, 2006 Share Posted September 8, 2006 When I run exactly the same code using Firefox, I see a large red square.I'd say there's something wrong with your GD library and/or set-up. Time to ask your web host for assistance Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88302 Share on other sites More sharing options...
wildteen88 Posted September 8, 2006 Share Posted September 8, 2006 Rather than creating a PNG, maybe your browser doesnt support PNG. try a jpeg image instead so use:[code=php:0]// example1.php// set the HTTP header type to JPEGheader("Content-type: image/jpeg");// set the width and height of the new image in pixels$width = 350;$height = 360;// create a pointer to a new true colour image$im = ImageCreateTrueColor($width, $height);// sets background to red$red = ImageColorAllocate($im, 255, 0, 0);ImageFillToBorder($im, 0, 0, $red, $red);// send the new GIF image to the browserImagejpeg($im);// destroy the reference pointer to the image in memory to free up resourcesImageDestroy($im);[/code]Goto example.php you should get a red box. Also what does this return:[code]<?php echo '<pre>' . print_r(gd_info(), true) . '</pre>'; ?>[/code]Also what OS is your server running on, *nix (linux, unix, mac) or Windows? Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88303 Share on other sites More sharing options...
ahmed17 Posted September 8, 2006 Author Share Posted September 8, 2006 when i use this code [code]<?php echo '<pre>' . print_r(gd_info(), true) . '</pre>'; ?>[/code]the result is Array( [GD Version] => bundled (2.0 compatible) [FreeType Support] => 1 [FreeType Linkage] => with freetype [T1Lib Support] => [GIF Read Support] => [GIF Create Support] => [JPG Support] => 1 [PNG Support] => 1 [WBMP Support] => 1 [XBM Support] => ) Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88640 Share on other sites More sharing options...
ahmed17 Posted September 8, 2006 Author Share Posted September 8, 2006 [quote author=AndyB link=topic=107272.msg430480#msg430480 date=1157714602]When I run exactly the same code using Firefox, I see a large red square.I'd say there's something wrong with your GD library and/or set-up. Time to ask your web host for assistance[/quote] I run exactly the same code using Firefox, but give the same result[code]‰PNG [/code] Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88767 Share on other sites More sharing options...
Barand Posted September 9, 2006 Share Posted September 9, 2006 Do you have error reporting switched off?Put this at top of the script[code]error_reporting(E_ALL);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88768 Share on other sites More sharing options...
AndyB Posted September 9, 2006 Share Posted September 9, 2006 Well, just to close out the loop of my results - example1.php generates the image that I can see running Firefox 1.0.7 (unchanged since I downloaded it) on a PC with Win2K Pro. Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88769 Share on other sites More sharing options...
ahmed17 Posted September 9, 2006 Author Share Posted September 9, 2006 if any server program like AppServ support gd libary( work on loca)l ..plz tell me Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88808 Share on other sites More sharing options...
AndyB Posted September 9, 2006 Share Posted September 9, 2006 doh! Perhaps you could have explained it wasn't working on your local machine a little earlier in the thread. Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-88816 Share on other sites More sharing options...
ahmed17 Posted September 9, 2006 Author Share Posted September 9, 2006 [quote author=AndyB link=topic=107272.msg431043#msg431043 date=1157768168]doh! Perhaps you could have explained it wasn't working on your local machine a little earlier in the thread.[/quote]ok :)...wat i do know ? Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-89027 Share on other sites More sharing options...
AndyB Posted September 9, 2006 Share Posted September 9, 2006 I'll tell you what I do. GD doesn't run on my local machine either, so I do all of my final GD testing on a live web server off in a separate test folder. Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-89071 Share on other sites More sharing options...
ahmed17 Posted September 9, 2006 Author Share Posted September 9, 2006 thanks AndyB more :D Gd work on a live web server now .. but testing script will take long time if i design it and then upload to test ....for this perphas i ask how i can test gd on local machine Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-89080 Share on other sites More sharing options...
AndyB Posted September 9, 2006 Share Posted September 9, 2006 OK, start a new topic. I suggest titling it "GD on localhost" so everyone will know what you're trying to do.State exactly what you have for the server O/S, what version of php you're running, and that you have GD2 as part of the package and quote the GD info that you quoted earlier in this thread. That should get you the assistance you need (let's hope). Quote Link to comment https://forums.phpfreaks.com/topic/20050-help-me-with-gd/#findComment-89099 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.