PHP use GD Library to make verification code does not display pictures

Source: Internet
Author: User
Tags imagejpeg

Write a build verification code, but cannot display the picture in the local wampsever environment

But I uploaded it to the server, but I can show it.

The local GD library is open

Novice make confused, ask for advice!

    
  

Reply content:

Write a build verification code, but cannot display the picture in the local wampsever environment

But I uploaded it to the server, but I can show it.

The local GD library is open

Novice make confused, ask for advice!

    
  

The picture is not displayed generally because the generated picture stream is not correct, you directly in the browser open the address of this image.
Perhaps you will find:

phpFatal error :xxxxxx or Warning : xxxxx

The error prompt.

In addition, the general local is open Display_erorrs, but the server production environment inside for security is to shut down all the error output.

    1. Check file encoding, utf-8 usually.
    2. Try to clean the ob_clean(); wrong output buffer.

This piece of code, why look so familiar with ...!

The main topic should be extracted from the PHP e-commerce Web development tutorials on the web.

This code has a bug, that is, in the
$fontfiles =array ("Simyou. TTF ");
$fontfile = '. /fonts/'. $fontfiles [Mt_rand (0, Count ($fontfiles)-1)];

Fonts folder, you did not place Simyou.ttf or other related font files, so the server could not find the font.

Just fill in the TTF font file.

The output verification code can not have other content output!!
For your situation, it is because your local environment display_errors open,
You just need to be on top, that's require_once '. /include.php '; The top of this line is added Ini_set (' display_errors ', ' Off '); You can do it.
Besides, your .

Related Article

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.