Watermarking Images using PHP

Submitted by: 
Visitors have accessed this post 3198 times.

Seeing one’s work altered without permission can be frustrating,
as can discovering your work on blogs that are void of any credit.
The first response for most photographers is to watermark
their images, ensuring that their logo or website graces
every image that hits the internet.

Read more about this article at this link

Using this Code, you will be able to put watermark on your images using
PHP. If you want a different watermark, you can create your own
using Photoshop.

Code Features:
1. Put watermark on Images
2. Input type file REQUIRED
3. Check if a Directory Exists
4. Check if a Directory is Empty
5. Create a Directory is not Exists
6. Display Live system date and time
7. Open New Tab using anchor tag (< a >)


1. Before you can run this code/script, you need GD Library Installed in your Server.
For more info about PHP GD Library, visit this link
2. This Script is coded in PHP 7.1.8 and I don't know if this script will run smoothly on older versions of PHP

Code Preview Available at codepreview.x10host.com

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Actually, it's the first time I've heard this two ways (Discrete Cosine Transform and Discrete Wavelet Transform) but the code uses only those predefined functions in PHP GD Library. You can refer to this link for more info.

hi there,,

Before i want to appologize my english bad,, sorry,,
i want ask something, what method you use to watermarking the image ?
is that, Discrete Cosine Transform (DCT) or Discrete Wavelet Transform (DWT)
or another else ?

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.