phpQuestioner Posted August 5, 2007 Share Posted August 5, 2007 I'm trying to start using PHP GD Library and I have checked php_info() on my server and GD Library is enable. I tried using a script from this site (http://www.phpfreaks.com/tutorials/105/0.php) to test if my GD Library worked and I kept getting the error "Image Not Found". I am running PHP 4.3.11 and I cannot find my "php_gd.dll" file; so I can not uncomment the lines I need to. Also, I went to php.net too look for binaries for 4.3.11 and could not find them. Anyone one got any suggestions on where I can go to from here to either activate or make sure my GD Library is ready to work? Because, right now; it does not seem to........ Quote Link to comment https://forums.phpfreaks.com/topic/63383-solved-gd-library-question/ Share on other sites More sharing options...
phpQuestioner Posted August 5, 2007 Author Share Posted August 5, 2007 No, let me correct the error message. It is actually this error message: The image “http://mydomain.com/08-04-2007.php” cannot be displayed, because it contains errors. Here was code I used: <?php header ("Content-type: image/png"); $img_handle = ImageCreate (230, 20) or die ("Cannot Create image"); $back_color = ImageColorAllocate ($img_handle, 0, 10, 10); $txt_color = ImageColorAllocate ($img_handle, 233, 114, 191); ImageString ($img_handle, 31, 5, 5, "My first Program with GD", $txt_color); ImagePng ($img_handle); ?> Quote Link to comment https://forums.phpfreaks.com/topic/63383-solved-gd-library-question/#findComment-315940 Share on other sites More sharing options...
severndigital Posted August 5, 2007 Share Posted August 5, 2007 double check your GD settings. i copied and pasted your code and with GD turned off, i got the exact error. with GD turned on, the code worked perfectly with no changes. Quote Link to comment https://forums.phpfreaks.com/topic/63383-solved-gd-library-question/#findComment-315956 Share on other sites More sharing options...
phpQuestioner Posted August 20, 2007 Author Share Posted August 20, 2007 OK - So I kind of put a pin in the this topic; and moved on to something else, but now I am back to it. I am still getting the same error message, because I just re-tested this code. I have include my gd info from my php_info() below; based on it, could someone tell me why PHP GD Image Code is not displaying/working? Quote Link to comment https://forums.phpfreaks.com/topic/63383-solved-gd-library-question/#findComment-329098 Share on other sites More sharing options...
Barand Posted August 20, 2007 Share Posted August 20, 2007 Run your script with the header() line commented out. That will allow it to report errors Quote Link to comment https://forums.phpfreaks.com/topic/63383-solved-gd-library-question/#findComment-329108 Share on other sites More sharing options...
phpQuestioner Posted August 20, 2007 Author Share Posted August 20, 2007 ok - i commented out the header, but no error - just this stuff: ‰PNG IHDRæ£þÓêPLTE ér¿`ŽLÚIDATxœåбAàŸMhF®!ža’+(„WÙË&ª;‘xë”Z…‡Ði'JD£RÑ+®0wÁ¯`«ÙýòÏfø³Sc CYeŸGEý˜õà«*T,(´ªšðñ£Peí|&H»;?&¦±éÖ³½54IÇ%¥öÉé¿×‘[¢•!‘i¡)1kg$;ÇP E‚˜o™¶²,{»—z÷·†…Âå:`Ž¾´¹Ì”¨Ž,³fSñƒ8Ÿ¨Æ7ȽíEµ¯E´ª,ÒNçÛ@µ4&‚øg••Gé2ü¶'€£D?ijžIEND®B`‚ Quote Link to comment https://forums.phpfreaks.com/topic/63383-solved-gd-library-question/#findComment-329121 Share on other sites More sharing options...
marcus Posted August 20, 2007 Share Posted August 20, 2007 Try: <?php $img_handle = ImageCreate (230, 20) or die ("Cannot Create image"); $back_color = ImageColorAllocate ($img_handle, 0, 10, 10); $txt_color = ImageColorAllocate ($img_handle, 233, 114, 191); ImageString ($img_handle, 31, 5, 5, "My first Program with GD", $txt_color); header("Content-type: image/png"); imagepng($img_handle); ?> Quote Link to comment https://forums.phpfreaks.com/topic/63383-solved-gd-library-question/#findComment-329129 Share on other sites More sharing options...
phpQuestioner Posted August 20, 2007 Author Share Posted August 20, 2007 Yeah Mgallforever That Did The Trick - Thank You So Much - How Did Your Script Make The Differance Compared To The Orginal Script? Quote Link to comment https://forums.phpfreaks.com/topic/63383-solved-gd-library-question/#findComment-329130 Share on other sites More sharing options...
marcus Posted August 20, 2007 Share Posted August 20, 2007 I'm giving all the information need before outputting it to an image. Quote Link to comment https://forums.phpfreaks.com/topic/63383-solved-gd-library-question/#findComment-329133 Share on other sites More sharing options...
phpQuestioner Posted August 20, 2007 Author Share Posted August 20, 2007 Also - How Do I Use This Script To Create/Resize A Image That I Already Have On My Web Host? I have a few JPG files I would like to make into thumbnails. Quote Link to comment https://forums.phpfreaks.com/topic/63383-solved-gd-library-question/#findComment-329134 Share on other sites More sharing options...
phpQuestioner Posted August 20, 2007 Author Share Posted August 20, 2007 I found this script in the manual and it works, but now how do I scale it to be 100px X 100px ? <?php function LoadJpeg($imgname) { $im = @imagecreatefromjpeg($imgname); /* Attempt to open */ if (!$im) { /* See if it failed */ $im = imagecreatetruecolor(150, 30); /* Create a black image */ $bgc = imagecolorallocate($im, 255, 255, 255); $tc = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 150, 30, $bgc); /* Output an errmsg */ imagestring($im, 1, 5, 5, "Error loading $imgname", $tc); } return $im; } header("Content-Type: image/jpeg"); $img = LoadJpeg("2001-Dodge-Dakota.jpg"); imagejpeg($img); ?> Quote Link to comment https://forums.phpfreaks.com/topic/63383-solved-gd-library-question/#findComment-329231 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.