A large number of errors suddenly occurred when creating the verification code. please take a look. thank you.

Source: Internet
Author: User
Create a verification code, suddenly a large number of errors, please help look, thank you I am trying to write a verification code php script, first began to prompt the image function is not available, so I added the php5-gd
After the installation is complete, it is found that the function still cannot be found by Tieshi.
So I used sudo/etc/init. d/apache2 focus-reload.
Then a function problem is prompted, but a large amount of warning information is displayed.
I have checked and modified the php. ini file error. report = E_ALL &~ E_NOTICE
Restart the server,
The verification code is as follows:
 


Reply to discussion (solution)

Check by yourself. The definition and usage of constants are inconsistent.

Check by yourself. The definition and usage of constants are inconsistent.


Thanks to the moderator, an error has caused so many problems that I have no patience. but now the imagettftext () function cannot find the font. I didn't see the font after reading the manual. how can I find it? How do I set the font path? does the font path refer to the font path of linux or the font of the gd library?

The absolute path must be used for font files. you can write them wherever you put them.

Obviously 23 rows have been prompted. the denominator in your division cannot be zero because there is an incorrect inversion here. $ the img variable contains miscellaneous values, so that the imagesetpixel function of 27 rows does not have an available image resource.

for($i=0;$i<5;$i++){        imageline($img,0,rand()%IDENTFY_HEIGHT,IDENTFY_WIDTH,rand()%INDENTFY_HEIGHT,$graphic_color);    }


 for($i=0;$i<50;$i++){        imagesetpixel($img,rand()%IDENTFY_WIDTH,rand()%IDENTFY_HEIGHT,$graphic_color);     }

Obviously 23 rows have been prompted. the denominator in your division cannot be zero because there is an incorrect inversion here. $ the img variable contains miscellaneous values, so that the imagesetpixel function of 27 rows does not have an available image resource.

for($i=0;$i<5;$i++){        imageline($img,0,rand()%IDENTFY_HEIGHT,IDENTFY_WIDTH,rand()%INDENTFY_HEIGHT,$graphic_color);    }


 for($i=0;$i<50;$i++){        imagesetpixel($img,rand()%IDENTFY_WIDTH,rand()%IDENTFY_HEIGHT,$graphic_color);     }



for($i=0;$i<5;$i++){        imageline($img,0,rand()%IDENTFY_HEIGHT,IDENTFY_WIDTH,rand()%INDENTFY_HEIGHT,$graphic_color);    }


 for($i=0;$i<50;$i++){        imagesetpixel($img,rand()%IDENTFY_WIDTH,rand()%IDENTFY_HEIGHT,$graphic_color);     }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.