Why can't I output a picture

Source: Internet
Author: User
Why can't I output a picture
Session_Start ();

Number of random codes
$_rnd_code = 4;

Create Random Code
for ($i =0; $i <4; $i + +) {
$_nmsg.=dechex (Mt_rand (0,15));
}

Save session
$_session[' Code ']=$_nmsg;

Long and high
$_width = 75;
$_height = 25;

Create an image
$_img = Imagecreatetruecolor ($_width,$_height);



Output image
Header (' content-type:image/png ');
Imagepng ($_IMG);

The output result is


Notice: Undefined variable: _rnd_code inD:\AMP\web\ide_tmp.phpOn line -



Warning: Division by zero inD:\AMP\web\ide_tmp.phpOn line -



Notice: Undefined variable: _heght inD:\AMP\web\ide_tmp.phpOn line -



Warning: Mt_rand (): Max (0) is smaller than min (1) inD:\AMP\web\ide_tmp.phpOn line -



Notice: Undefined variable: _rnd_code inD:\AMP\web\ide_tmp.phpOn line -



Warning: Division by zero inD:\AMP\web\ide_tmp.phpOn line -



Notice: Undefined variable: _heght inD:\AMP\web\ide_tmp.phpOn line -



Warning: Mt_rand (): Max (0) is smaller than min (1) inD:\AMP\web\ide_tmp.phpOn line -



Notice: Undefined variable: _rnd_code inD:\AMP\web\ide_tmp.phpOn line -



Warning: Division by zero inD:\AMP\web\ide_tmp.phpOn line -



Notice: Undefined variable: _heght inD:\AMP\web\ide_tmp.phpOn line -



Warning: Mt_rand (): Max (0) is smaller than min (1) inD:\AMP\web\ide_tmp.phpOn line -



Notice: Undefined variable: _rnd_code inD:\AMP\web\ide_tmp.phpOn line -



Warning: Division by zero inD:\AMP\web\ide_tmp.phpOn line -



Notice: Undefined variable: _heght inD:\AMP\web\ide_tmp.phpOn line -



Warning: Mt_rand (): Max (0) is smaller than min (1) inD:\AMP\web\ide_tmp.phpOn line -



Notice: Undefined variable: _rnd_code inD:\AMP\web\ide_tmp.phpOn line -



Warning: Division by zero inD:\AMP\web\ide_tmp.phpOn line -



Notice: Undefined variable: _heght inD:\AMP\web\ide_tmp.phpOn line -



Warning: Mt_rand (): Max (0) is smaller than min (1) inD:\AMP\web\ide_tmp.phpOn line -

‰png
Modify by error message
Then you have to:
Still unfriendly "captcha" picture
Comment out the header and open the error to see the error.
  • 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.