About 0x00
This article mainly analyzes PHP's use of the GD Library's imagecreatefrompng () function to reconstruct a PNG image may result in a local file inclusion vulnerability.
When the system exists the point that the file contains, can
Recently saw a lot of big companies have started to do a variety of pet chain, the most special is that the pet has a variety of parts and then different combinations and produce the corresponding pet pictures, looks relatively tall, but found that
Here once to support the upload of 2 pictures, upload the original and poor quality of the picture, the original image for the preservation of high quality pictures, poor quality of the graphic for Web page display.
PHP Code
Copy Code code as
That's the QR code.
Made a square and center transparent, white border picture to embed in the QR code image
But the original center black and white position is completely transparent after the synthesis, such as
How to handle this situation,
The code is as follows
Copy Code
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]
12. 3 The generation of automatic miniature graphsBecause of the large amount of data in the picture, the transfer process is relatively long, so when users browse the picture, often want to firstDisplays a thumbnail of a picture.Although you can
Php adds the image watermark instance function. Many functions are used to add watermarks to images in php, such as imagecreatefromjpeg, imagecreatefrompng, and getimagesize. these functions belong to the phpGD Library, therefore, we need to use
PHP supports simple upload of multiple image formats. You can simply write a PHP image upload file that supports jpg, png, gif, and other formats. if you want to support more formats, such as bmp, you can expand it by yourself. It is not
Simply write a PHP image upload, can support JPG, PNG, GIF and other formats of the picture, if you want to support more formats, such as BMP, you can expand their own. It is not object-oriented, and is simply recorded here for later access.
This
You can simply write a PHP image upload file that supports jpg, png, gif, and other formats. if you want to support more formats, such as bmp, you can expand it by yourself. It is not object-oriented. here we will simply record it so that we can use
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
01. php
/*
Drawing with Windows graphic Board
1: Create a canvas and set the size.
2: Create a pigment. (red, r Green G blue B, composed of three primary colors. The primary colors can be 0-from weak to strong ).
3: draw lines, write, draw
The following provides three code generation, compatibility is quite good, you can also customize the height and width oh.
function Imageresize ($srcfile, $tow, $toh, $tofile = "")
{
if ($tofile = = "") {$tofile = $srcfile;}
$info = "";
$data
I have a function to stitch two pictures below is my Code
$im = imagecreatefrompng("images/err.png"); $stamp = imagecreatefrompng('images/default.png'); $test = imagecreate(imagesx($stamp)+imagesx($im),imagesy($im)); $orange =
Php text watermark and thumbnail implementation code. ImageCreateFrom * the image loading function loads images with different suffixes: imagecreatefromgifimagecreatefrom?imagecreatefrompngimagecreatefromwbmp imagecreatefromstring in the format of
The following provides three generated reduction codes, which have good compatibility. You can also customize the height and width.Function imageresize ($ srcfile, $ tow, $ toh, $ tofile = ""){ If ($ tofile = "") {$ tofile = $ srcfile ;}$ Info = "";$
The following provides three generated reduction codes, which have good compatibility. You can also customize the height and width.
Function imageresize ($ srcfile, $ tow, $ toh, $ tofile = "")
{
If ($ tofile = "") {$ tofile = $ srcfile ;}
$
1. From which we can see that the function of the imagecreatetruecolor is obviously to create a black background picture, its first parameter is the width of the created picture, the second parameter is the height of the created picture, we put the
Use PHP GD, use good, one key to cut various sizes, pack and download. Always change the icon to understand, art to give you a 1024 logo, you have to PS a variety of sizes, so have this thing.
Core code
Copy Code code as follows:
Class
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.