473,725 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

imagecreate() function is not working and giving fatal error

1 New Member

I am using PHP 4.3.1 and i have written a little code for purpose of CAPTCHA Image.

i am running this code locally on localhost using IIS 5.0.
When i open the code page, i get an fatal error like:

Here is my code

Expand|Select|Wrap|Line Numbers
  1.     header ("Content-type: image/jpeg");
  2.     $img = imagecreate(100,30);
  3.     $black = imagecolorallocate($img, 0, 0, 0);
  4.     $white = imagecolorallocate($img, 255, 255, 255);
  5.     $text = "H6U84S";
  6.     imagestring($img, 14, 5, 5, $text, $white);
  7.     imagejpeg($img,'',100);    //Output Picture
  8.     imagedestroy ($img);    

And i am having this Fatal Error

Fatal error: Call to undefined function: imagecreate() in C:\Documents and Settings\majeed m\Desktop\Test\ test.php on line 2

Can any please help me out.
Jul 9 '07 #1
2 3023
5,821 Recognized Expert Expert
Heya, lwo3108. Welcome to TSDN!

Betcha that PHP was not compiled with GD support on your system. You can check this by running phpinfo(). Look for '--with-gd' in the configure options, and a section entitled 'GD'. If you don't have either, you'll need to recompile PHP.
Jul 9 '07 #2
1,584 Recognized Expert Top Contributor
Hi me too here, Try this...
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $array = gd_info();
  3. foreach ($array as $key => $val)
  4. {
  5. if ($key != "GD Version") {
  6. if ($val == true || $val == false) {
  7. if ($val == true) {
  8. $val = "Enabled";
  9. }
  10. elseif ($val == false)
  11. {
  12. $val = "Disabled";
  13. }
  14. }
  15. }
  17. echo "$key: $val <br>";
  18. }
  20. ?>
Jul 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Tim | last post by:
I'm running PHP 4.3.2 on a Win XP box with IIS 5.1. I am completely unable to get any of the image tags to function--it gives me an error such as the following: Fatal error: Call to undefined function: imagecreate() in D:\web sites....... I'm at a loss and I need to get this working. My understanding is that 4.3+ has offered these tags so I'm not quite certain as to what I'm doing incorrectly.
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or anything...it just returns a "1" (whereas it should return a "0") as far as I can tell. I have read the PHP...
by: Biffo | last post by:
I have PHP Version 5.0.3 installed on Windows XP Pro with IIS as the webserver. All is working well, except I get a - Fatal error: Call to undefined function mssql_connect() in C:\Inetpub\wwwroot\CertificateOccupancy\main.php on line 33 line 33: $conn = mssql_connect(toshibo,sa,ladeda) or die ("Could Not Connect to Database"); when trying to use mssql_connect. Info.php shows that the mssql module
by: inonzuk | last post by:
why strange you ask? here goes: I have been working with Php and Mysql for a week without any problems. Today I tried executing a php page that connects to mysql and creates a new database, I got this error: "Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\test\_debug_tmp.php on line 3". I did some reading on the net and checked all my configuration, and it
by: amit kumar | last post by:
I am calling a function which returns pointer to a map. The declaration of the map is map<int,vectxyz*>. vectxyz is a vector containing pointer to a class xyz. For map<int,vectxyz*>* p1 In the called function, I am using p1->find(1) which is returning a valid iterator and not going to the end. I am returning p1 from the called function. But in the calling function, find(1) is going to the end, i.e unable to find the key 1, which was...
by: Cal Lidderdale | last post by:
Linux RH New install. PHP installed --with-gd=shared. libgd-2.0... installed in /usr/lib PHP Fatal error: Call to undefined function: imagecreate() If I put extension=gd.so in php.ini I get PHP Warning: Unknown(): Invalid libr (maybe not a PHP library) 'gd.so' Every web search result I get says "just install GD" - Ah, it is...
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
by: Rymfax | last post by:
I have an application that is installing Drivers to the OS. I was using the UpdateDriverForPlugAndPlayDevices() function to handle this. It works fine, but on VISTA I get prompted by Windows Security if the Driver isn't pre-installed first. To avoid this I want to use the DiInstallDriver() function which will Pre-Install the driver first and then install it to any device that uses it. The problem I'm having is that everytime I try to...
by: saikiran.iitkgp | last post by:
Hi All, I have the php version 5.2.2 . When I am using " $im = imagecreate(......); " I am getting the following message "Fatal error: Call to undefined function imagecreate() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\server.php on line
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.