What is the difference between the Imagecreateformjpeg and imagecreate of the novice PHP drawing?

Source: Internet
Author: User
What is the difference between a novice PHP drawing imagecreateformjpeg and a imagecreate?
Header ("Content-type:image/gif"); Defining the output as an image type
$im =imagecreatefromjpeg ("bg.jpg"); Loading photos
$textcolor =imagecolorallocate ($im, 56,73,136); Set the font color to blue and the value to RGB color values
$FNT = "C:/windows/fonts/simhei.ttf"; Defining fonts
$text =iconv ("gb2312", "Utf-8", "Dandong Broken Bridge"); Convert Chinese to UTF-8 format
Imagettftext ($im, 30,0,150,120, $textcolor, $fnt, $text); Write TTF text to the diagram
Imagegif ($im); Create a GIF graphic
Imagedestroy ($im); End graph, free memory space
?>

In the example above, I put
$im =imagecreatefromjpeg ("bg.jpg"); Loading photos
Into
$im =imagecreate (200, 100);
There was a mistake. Why? I just want to replace the background image with my own defined box. PHP Graphics

Share to:


------Solution--------------------
One is loaded from the picture, a completely self-painted.
------Solution--------------------
After testing, your code is not syntactically wrong.
Just not setting the background 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.