The following simple to write a picture processing class, features include: watermarks, thumbnails and so on.However, there are two ways to generate thumbnails: one is to compress the pictures directly proportionally, and the other is to cut and then compress the images first. In my opinion, the difference between compression and cropping compression is:and other examples of compression: to ensure that the picture of the width and length of reasonable, and the picture has integrity. However, the
$ico _pic is the watermark you want to add watermark image, the other parameters are detailed description, if you look at this type of code can be downloaded to save PHP file and then use the call method behind said to call this generated watermark image class code.
$ico _pi
This article is mainly for you to introduce the PHP thumbnail generation and image watermark production process, PHP to achieve watermark addition and thumbnail generation of related steps, with a certain reference value, interested in small partners can refer to
1. Start
In the website upload picture process, often use the thumbnail function. Here I wrote a pic
Program
If you are familiar with PHP's GD library, it is not difficult to read this article!/******************************************************************************Parameter description:$max _file_size: Upload file size limit, unit byte$destination _folder: Upload file path$watermark: Whether additional watermark (1 for Watermark, other for no
PHP example: add a watermark to the uploaded image. The program that uses php (as the mainstream development language) to add a watermark to the uploaded image creates a graph by judging the file type and then copies it to the original image, filling and setting up re the pr
Know the usage, to implement our function is simple, with the following code can be easily implemented
The code is as follows
Copy Code
Header ("Content-type:image/jpeg"); Original image$DST = "Images/flower_1.jpg"; Get the original picture information$DST _im = Imagecreatefromjpeg ($DST);$DST _info = getimagesize ($DST); Watermark Image
Very powerful PHP image processing class, you can customize the image watermark, transparency, image scaling, image sharpening, picture rotation, picture flipping, picture cutting, picture inverse color. The specific code is as follows:
/***
PHP image processing using the Imagecopy function to add a picture watermark instance,
Adding a watermark to a picture is also a common feature in image processing. As long as you see the pictures in the page can easily get, you hard to edit the pictures do not want to be easy to take away by others to use, so add a
PHP image upload class; support for watermark-date folder-generating thumbnails; support for multifile Upload
You can use {Y} {m} {n} to change the current date.
Set_dir (dirname (_ FILE __). '/upload/', '{y}/{m}'); // save path. the options {y} {m} {d} are supported.
$ Up-> set_thumb (, 80); // Set the thumbnail size in pixels.
$ Up-> set_watermark (dirname (_ FILE _). '/jblog/
You can use {Y}{m}{n} to become the current date
Set_dir (DirName (__file__). ' /upload/', ' {y}/{m} '); Save path, support {y}{m}{d} these several options
$up->set_thumb (100,80); Thumbnail size setting. Units in pixels
$up->set_watermark (DirName (__file__). ' /jblog/images/watermark.png ', 6,90); Watermark Settings
$fs = $up->execute (); Start execution
Var_dump ($FS); Scenarios for testing the view class
}
Using PHP to upload the image watermark program is to determine the file type to build graphics, and then copy it to the original set up the graphics, fill and build rectangle, in order to write imagestring () or the original has been fixed image program to determine the watermark type: One is a string, Another is to a
For the project to be handed over to accp5.0 certification on Christmas day 25, there is a requirement that the cover of all books in the bookstore should be placed under \ images \ convers, all the pictures under the referenced path must be added with the store name watermark image of the bookstore. That is to say, the HTTP request is intercepted. Naturally, it can be done by httphandler. In consideration,
To the users of Photoshop software to the detailed analysis to share some of the image to add a watermark method.
Method Sharing:
First of all, try not to be too big, do not let watermark distracting affect the picture itself.
The watermark is positioned as neatly as possible and can be con
/**************************************************************
Parameter description:
$max _file_size: Upload file size limit, unit byte
$destination _folder: Upload file path
$watermark: Whether additional watermark (1 is watermark, the other is not watermark);
Instructions for use:
1. Remove the "Extension=php_gd2
From the Internet to find the predecessors to write code, and then optimize the collation, the realization of the image overlay watermark, that is, the text overlay, and then realize the total text according to the length of the automatic line-wrapping overlay Text
ImportJavax.imageio.ImageIO;Importjava.awt.*;ImportJava.awt.image.BufferedImage;ImportJava.io.File;ImportJava.io.FileOutputStream;/** * Create
$ Ico_pic is the watermark image you want to add a watermark to the image. Other parameters are described in detail, if you look for such code, you can download and save it as a PHP file, and then use the call method described later to call the watermark
php to add a watermark for the picture, apply to the png/jpg/gif format, you need friends can refer to the following Code as follows: lt;?php/** nbsp;* picture watermark (for png/jpg/gif format) nbsp;*nbsp; nbsp;* @author flynetcn nbsp;* nbsp;* @param $srcImg Original picture nbsp;* @param $waterImg watermark picture nbsp;* @param $savepath save path nbsp;* @pa
Picture operation in the application of the Web site is quite wide, especially now the internet is highly developed, a lot of content is shown by pictures, now we talk about using PHP to operate upload pictures, 3D picture drawing, picture scaling, picture rotation, picture cropping, image add watermark.
1, the use of PHP functions of the GD library to draw 3D sector statistics
code as follow
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.