My PHP Captcha has this problem: Image corrupt or truncated

Source: Internet
Author: User
Tags truncated
The problem with my PHP captcha is this:
Image corrupt or Truncated:http://localhost/htsys/?c=login&m=yzm
No matter how I debug always can not display the captcha picture, prompting the image for its own reasons can not be displayed ...
Tangled Up


Reply to discussion (solution)

Try 1. Image path problem, change the absolute path, or a static diagram on the same path, and exclude if it can be displayed.
Try 2. Image encoding, whether it is a problem at the time of generation, the code that generates the image, a line of debugging.

Generate image code No problem, I changed a lot of verification code class, or so, no words ah,

Public Function Yzm () {///Login Page Verification Code method header ("Content-type:image/png"); $num = $_get[' num ']; $imagewidth =50; $imageheight =20; $numimage = Imagecreate ($imagewidth, $imageheight); Imagecolorallocate ($numimage, 238,97,85); for ($i =0; $i
   
  

I get a random string of num from the path and then let the YZM function get the build, it's so simple, really don't know why, just start still good,

public function Yzm () {Header ("content-type:image/png"); $num = $_get[' num '];$ IMAGEWIDTH=50, $imageheight =20; $numimage = Imagecreate ($imagewidth, $imageheight); Imagecolorallocate ($numimage, 238,97,85); for ($i =0; $i 
     
     

  • 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.