Creating Watermark image by PHP

View: 448    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: References   Fields: Other

10 point/3 review File has been tested

When you want to add an "authentication mark" (watermark) as a background image to an image file on your website, there are many ways to do this, such as using Photoshop, or other tools out there, today I would like sharing the code you can do for your image watermark without using any software, and you do not need to spend too much time.

Introduction

Tạo ảnh Watermark bằng PHP

When you want to add an "authentication mark" (watermark) as a background image to an image file on your website, there are many ways to do this, such as using Photoshop, or other tools out there, today I would like sharing the code you can do for your image watermark without using any software, and you do not need to spend too much time.

The following code will help you do that:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
<?php
function watermark_image($file, $destination, $overlay = "images/watermark.png", $X = 10, $Y = 10){
$watermark =    imagecreatefrompng($overlay);
$source = getimagesize($file);
$source_mime = $source['mime'];
$source_x = $source['width'];
$source_y = $source['height'];
if($source_mime == "image/png"){
$image = imagecreatefrompng($file);
}else if($source_mime == "image/jpeg"){
$image = imagecreatefromjpeg($file);
}else if($source_mime == "image/gif"){
$image = imagecreatefromgif($file);
}
imagecopy($image, $watermark, $X, $Y, 0, 0, imagesx($watermark), imagesy($watermark));
imagepng($image, $destination);
return $destination;
}
?>

I would like to explain the parameters used are as follows:

- $ File: path to your image
- $ Destination: the path to the resulting image file after creation
- $ Overlay: URL of your watermark
- $ X, $ Y: the watermark image placement, the default is 10

To use this function you use as follows:

  <img src = "<? php echo watermark_image (" 96.jpg "," temp / ". time ().". jpg "); ?> '>

If you do have any problems, please leave a comment, I'll help you.
Good luck!

Creating Watermark image by PHP

Creating Watermark image by PHP Posted on 08-08-2015  When you want to add an "authentication mark" (watermark) as a background image to an image file on your website, there are many ways to do this, such as using Photoshop, or other tools out there, today I would like sharing the code you can do for your image watermark without using any software, and you do not need to spend too much time. 3.3333333333333/10 448

Comment:

To comment you must be logged in members.

Files with category

  • Instructions for installing and configuring Windows Live Mail on Windows 10 simple

    View: 2907    Download: 0   Comment: 0   Author: none  

    Instructions for installing and configuring Windows Live Mail on Windows 10 simple

    Category: References
    Fields: Other

    0.66666666666667/6 review
    Windows 10 pre-installed Mail application for managing personal email on the device. The latest version of this application but improved a lot and support other email accounts such as Gmail or Yahoo Mail but users almost no "salty" really with this...

  • Step by step instructions to create social networking buttons with CSS3

    View: 2012    Download: 0   Comment: 0   Author: none  

    Step by step instructions to create social networking buttons with CSS3

    Category: References
    Fields: Other

    0.5625/8 review
    CSS3 help web designers have the ability to create buttons (buttons) very nice, today I will share with you two tips decoration for button in your web becomes radiant beauty that no need to use photoshop.

  • You should understand the CSS Box Shadow

    View: 2145    Download: 0   Comment: 0   Author: none  

    You should understand the CSS Box Shadow

    Category: References
    Fields: Other

    1.0357142857143/14 review
    Effects his shadow was introduced in the previous article, however, in this article, I will guide more specific about shadow attributes, you try it with anything. First we try to learn css following paragraph:

  • How to do button movement with beautiful CSS3

    View: 1832    Download: 0   Comment: 0   Author: none  

    How to do button movement with beautiful CSS3

    Category: References
    Fields: Other

    0/6 review
    Previously to create motion effects button, you must draw the button in photoshop, then switched to flash to make it possible to move. But now you need not spend too much time doing it, all because of the emergence of CSS3.

  • Create a dropdown menu with CSS3 effects with beautiful transtions

    View: 2111    Download: 0   Comment: 0   Author: none  

    Create a dropdown menu with CSS3 effects with beautiful transtions

    Category: References
    Fields: Other

    0.375/12 review
    More of the dropdown menu you want to introduce to you, this will have the effect menu transitions (converted background of menu background from pale to dark). This menu works well on browsers like FF, Chrome, Safary, but unfortunately did not work...

  • How to hack css for all browsers you should know

    View: 1737    Download: 0   Comment: 0   Author: none  

    How to hack css for all browsers you should know

    Category: References
    Fields: Other

    1.35/10 review
    In the process of web design, which makes it the most headaches is how to design web pages that you can run on the browser. Especially when clients use the old as IE6 browser such. However, with this article, you will easily edit interface runs well...

  • Create Accordion with extremely beautiful CSS3

    View: 2168    Download: 0   Comment: 0   Author: none  

    Create Accordion with extremely beautiful CSS3

    Category: References
    Fields: Other

    0.64285714285714/7 review
    Accordion is a technique that helps you shortened the content that you want displayed on the website. It is often used for the display of submenus. In addition you can also use it for content, images. Before applying this procedure, you have to use...

  • Create the effect Hovercho images with Webkit and CSS3 is great

    View: 1854    Download: 0   Comment: 0   Author: none  

    Create the effect Hovercho images with Webkit and CSS3 is great

    Category: References
    Fields: Other

    0.75/6 review
    WebKit is one open source application framework provides the necessary components built one for your web browser. Along with CSS3, cả have contributed to very nice effect những previously only using JavaScript or JQuery thực beige.​

 

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd