009-Generate watermark picture + generate thumbnail (PHP)

Source: Internet
Author: User
Tags watermark images
This article is about creating watermark images and generating thumbnails (PHP), and now share to everyone, a friend in need can look


<?php/** * Generate watermark Picture *///1. Get Picture Resource $big = Imagecreatefromjpeg ('./kaola.jpg ');    Big picture $small = Imagecreatefrompng ('./t1.png '); Watermark map//2. Get image Size list ($BW, $BH) = GetImageSize ('./kaola.jpg '); list ($w, $h) = GetImageSize ('./t1.png ');//imagecopymerge (Dst_im, Src_im, dst_x, dst_y, src_x, src_y, Src_w, Src_h, pct)//imagecopymerge ("Target graph", "watermark Map", "x-coordinate of the target graph", "y-coordinate", "X" of the watermark graph, "y "," Wide "," high "," transparency "); Imagecopymerge ($big, $small, $BW-$w, $BH-$h, 0, 0, $w, $h, imagepng); Imagedestroy ($ Big); Imagedestroy ($small); ##################################################################################/* * * Generate thumbnail image */$big = Imagecreatefromjpeg ('./kaola.jpg '); list ($w, $h) = GetImageSize ('./kaola.jpg ');//Create small canvas $small = IMAGECR Eatetruecolor ($w/2, $h/2);//copy image and modify size//imagecopyresampled (Dst_image, Src_image, dst_x, dst_y, src_x, src_y, Dst_w, DST _h, Src_w, Src_h) imagecopyresampled ($small, $big, 0, 0, 0, 0, $w/2, $h/2, $w, $h); Imagepng ($small, './t6.png '); imagedestr Oy ($big); Imagedestroy ($small);? >


function encapsulation

https://blog.csdn.net/liguanjie8/article/details/79835373

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.