1. Open a picture that already exists
The parameter of the function Imagecreatefromjpeg () is the path where the file is located, and the return value is the resource identifier of the picture that the parameter refers to. This function creates a new image from an existing image and does not simply open the original image itself. If you change the picture's suffix name. jpg to. png, you cannot open the file even with the function imagecreatefrompng (), because the picture is essentially a JPG image.
2. Get the related properties of the picture
$x pixels ";
echo "
";
echo "
";
echo "Picture Cc.jpg high for:$y pixels";
? >
In addition, through a function not belonging to the GD Library getimagesize (), you can get the size of the picture and other related properties, the function of the syntax is as follows:
Array getimagesize (string $filename [, array &imageinfo])
";
}
? >
The third element is the format of the picture, and its value means the following:
1: The picture is GIF format
2: Indicates that the picture is in JPG format
3: The picture is in PNG format
4: The picture is SWF format
5: Indicates that the picture is PSD format
6: The image is BMP format
"
>
3. Add the watermark effect to the picture
• Get the width and height of the picture you want to add a watermark to
• Determine whether the picture size meets the watermark text size
• Determine the position of the watermark effect in the picture
• Set the color blending mode of the image
• Create a watermark effect
• Releasing resources
-->0) {$uploadfile = "./". Time (). "
_ ". $_files[' userfile ' [' name ']; if (copy ($_files[' userfile '] [' tmp_name '], $uploadfile)) {Makeimagewatermark ($uploadfile, 2, "Photo by Mac", 16, "#
43042A ");
echo ""; else {echo "uploadwrong!
"; }}?>
<title>19.9.php</title>
Select Upload Picture:
4. Generate thumbnails of existing pictures
The first and second parameters are the target image, the original image identifier, the next 4 parameters are the destination image and the original image copy location coordinates, the last 4 parameters are the destination image and the original image of the replication area of the width of the height.
!! Using the function imagecopyresampled () function