What is the difference between imagecreateformjpeg and imagecreate for a new PHP image?
Source: Internet
Author: User
What is the difference between imagecreateformjpeg and imagecreate for new PHP plotting? & Lt ;? Phpheader ("content-type: image/gif"); & nbsp; // define the output as image type. what is the difference between imagecreateformjpeg and imagecreate in PHP drawing?
Header ("content-type: image/gif"); // defines the output as an image type.
$ Im = imagecreatefromjpeg ("bg.jpg"); // load the photo
$ Textcolor = imagecolorallocate ($ im, 56,73, 136); // set the font color to blue and the value to RGB.
$ Fnt = "c:/windows/fonts/simhei. ttf"; // define the font
$ 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 graph
Imagegif ($ im); // create a gif image
ImageDestroy ($ im); // ends the image and releases the memory space.
?>
In the above example
$ Im = imagecreatefromjpeg ("bg.jpg"); // load the photo
Change
$ Im = imagecreate (200,100 );
An error occurs. Why? I just want to change the background image to a custom box. Share PHP graphics:
------ Solution --------------------
One is loaded from an image, and the other is completely self-painted.
------ Solution --------------------
After testing, your code has no syntax error.
The background color is not set.
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