Pictures in the comparison to zoom in and out, this takes advantage of the PHP Tutorial GD library function is implemented, we will use to Imagecreatetruecolor (), imagecopyresampled () to operate
function My_image_resize ($src _file, $dst _file, $dst _width=32, $dst _height=32) {if ($dst _width echo "Params width
Network Packet Troubleshooting Guide-class Linux platform background informationI've been testing k8s recently, and if you know or get in touch with Docker, you know that most of the networks associated with Docker are on bridging, routing, Iptables. If you happen to have contact with k8s, and understand the principle behind it, you must know that Kube-proxy iptables play to fly up. Of course, you may think of some of the wrong tools, such as I used to grab the package tool, or route tracking to
------------------------------------------------------------------------------------------- There are no string types in the C language, but there are many string-handling functions available for the convenience of manipulating strings. such as: input and output string, copy of string, connection, comparison and other operation functions. It is important to note that in the use of input and output, i.e. gets,The puts function should introduce the header file In addition, the use of connectedWhe
= $dstpath;Echo $this->dstimg;}}?>Method of calling the class$resizeimage = new Resizeimage ("Image source file Address", "200", "100", "0", "thumbnail address");
Just use the above words, you can generate thumbnails, where the source file and thumbnail address can be the same, the 200,100 represents the width and height
Example 2
PHP thumbnail, such as proportional lossless compression, can fill the blank area supplemental color
The code is as follows
Copy Code
Copy CodeThe code is as follows:
Original image
$DST = "/upload/20120914/20120914040740-0.jpg"; Note that the picture path should be correct
Get the original picture information
$DST _info = getimagesize ($DST);
Switch ($DST _info[2])
{
Case 1:
$DST _im =imagecreatefromgif (
Add watermark to the picture is a common and very useful function of PHP program, let me give you a detailed introduction to the PHP PNG transparent background Watermark program code bar.
The code is as follows
Copy Code
Original image$DST = "/upload/20120914/20120914040740-0.jpg"; Note that the picture path should be correctGet the original picture information$DST _info = getimage
The prototype of the known strcpy function is:Char *strcpy (char *dst, const char *SRC);
Implementing the strcpy function
Explain why you want to return char *
If you consider the case of DST and src memory overlap, strcpy how to implement
implementation code for 1.strcpyChar* STRCPY (Char*DST,Const Char*SRC)//[1]{assert (
Most of the site generated thumbnails are proportional operation, today we look at can be fixed picture size "> picture size, not enough place automatically fill in the blanks Oh." A friend in Need can refer to it.
Error_reporting (E_all);
Test
Imagezoom (' 1.jpg ', ' 2.jpg ', ', ', ' #FFFFFF ');
/*
PHP thumbnail function:
Equal scale lossless compression, can fill supplementary color author: Andy
Hosting Format:
BMP, JPG, GIF, png
Param
@srcimage: Picture to shrink
@dstimage: Pic
Sometimes upload images need to add a watermark to the site, watermark can be divided into text watermark and image watermark, the following implementation of these two kinds of watermark text watermark is to add text on the picture, mainly using the Imagefttext method of GD library, and need font file. The effect figure is as follows:
The implementation code is as follows: nbsp; code as follows: $dst _path = ' dst.jpg '; nbsp;//Create an instance
Copy Code code as follows:
Original image
$DST = "/upload/20120914/20120914040740-0.jpg"; Note that the picture path should be correct
Get the original picture information
$DST _info = getimagesize ($DST);
Switch ($DST _info[2])
{
Case 1:
$DST _im =imagecreatefro
Text watermark
Text watermark is to add text on the picture, mainly using the Imagefttext method of GD library, and need font file. The effect chart is as follows:
The implementation code is as follows:
Copy Code code as follows:
$dst _path = ' dst.jpg ';
Create an instance of a picture$DST = imagecreatefromstring (file_get_contents ($DST _path
Most of the site generated thumbnails are proportional operation, today we have to see the size of the image can be fixed "> image size, not enough to automatically fill the blank Oh. If you need a friend, please refer to it.
Error_reporting (E_all);
Test
Imagezoom (' 1.jpg ', ' 2.jpg ', +, ' #FFFFFF ');
/*
PHP thumbnail functions:
Equal proportional lossless compression, can be filled with supplemental color Author: Andy
Hosting Format:
BMP, JPG, GIF, png
Param
@srcimage: Picture t
Text Watermark
Text watermark is to add text on the picture, the main use of GD library Imagefttext method, and the need for font files. As follows:
The implementation code is as follows:
Copy the Code code as follows:$dst _path = ' dst.jpg ';
Create an instance of a picture$DST = imagecreatefromstring (file_get_contents ($DST _path));
Make a text.$font = './SIM
Copy CodeThe code is as follows:
Error_reporting (E_all);
Test
Imagezoom (' 1.jpg ', ' 2.jpg ', +, ' #FFFFFF ');
/*
PHP thumbnail functions:
Equal proportional lossless compression, can be filled with supplemental color Author: Andy
Hosting Format:
BMP, JPG, GIF, png
Param
@srcimage: Picture to zoom Out
@dstimage: the picture to save
@dst_width: Reduce the width
@dst_height: Reduce the high
@backgroundcolor: Complementary colors such as: #FFFFFF support 6-bit does not support 3-bit
*/
function
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.