• Login
  • Register
Sunday, July 19, 2026
Generate QR Codes
Free PDF Tools
Free Web Audit 360
TechSansar.com
  • Services
  • Top Posts
  • Nepali IT
  • Startups
  • Tech News
  • Categories
    • News
      • Tech
No Result
View All Result
TechSansar.com
  • Services
  • Top Posts
  • Nepali IT
  • Startups
  • Tech News
  • Categories
    • News
      • Tech
No Result
View All Result
TechSansar.com

Create Watermark of image using PHP

TechSansar Editor by TechSansar Editor
November 3, 2020
in How To, Software, Tips & Tricks, Tutorials
A A
0
watermark using php

Creating a watermark for normal individuals is not an easy task. For a professional designer, it is an easier task to do. Let’s create a system that will help you create an image with a watermark in just a minute of time using PHP. We decide to use PHP as it is one of the most popular programming language in the context of Nepal.

Doing it on the local machine requires xampp or wamp or lamp or mamp. The purpose of using one of these is they provide PHP and Apache server to work locally.

Step 1: Loading the images

$logo = imagecreatefrompng('logo.png');
$image = imagecreatefrompng('image.png');
here we are using the PHP function imagecreatefrompng, which is used to create a new image from the given URL. In our context, the two images are in the same directory of the index.php file.

Step 2: Getting the height and width along with the margins

$margin_right = 500;
$margin_bottom = 350;
$img_width = imagesx($logo);
$img_height = imagesy($logo);
here we are using another PHP function called imagesx and imagesy.  imagesx has been used to get the image width and imagesy to get the image height.

Step 3: Positioning the image and aligning the logo as per the calculation

imagecopy($image, $logo, imagesx($image ) - $img_width - $margin_right, imagesy($image) - $img_height - 
$margin_bottom, 0, 0, imagesx($logo), imagesy($logo));

here we are positioning the image that we want to use as a watermark over another.

Step 4: Output and freeing memory

header('Content-type: image/png');
imagepng($image);
imagedestroy($image);

here we are displaying the output and freeing the memory that has been held during the operation.

Results

Images that have been used:

watermark imagewatermark logo

Output Generated:

Related Post

Power Automate is once again getting a new name! #PowerAutomate #Flow #Workflows

6 things you can do to speed up your Windows 11 computer

Speed up your Windows 11 computer by reducing startup time, here is how to

How to reduce background noise during Microsoft Teams or Zoom meetings

watermark output

Source Code

Tags: PHPProgramming
Share213Tweet133Send
Previous Post

Test Internet Speed using Python

Next Post

Fix for “Sorry, another account from your organization is already signed in on this computer.”

Related Posts

Power Automate app link menu
Software

Power Automate is once again getting a new name! #PowerAutomate #Flow #Workflows

Not a surprise, especially when Microsoft renames its tools. Power Automate, which was renamed as Microsoft Flows, will now be...

by tsGeek
July 24, 2024
CPU utilization in Windows 11
Computing

6 things you can do to speed up your Windows 11 computer

Got a that resourceful computer with a decent amount of memory, SSD storage and latest generation of that Intel chipsets;...

by tsGeek
July 24, 2024

Recent News

Gen Z Protest Kathmandu 2025

July 4, 2026
The Launch That Moved Syuchatar: YetiCloud.AI and the Night Nepal’s Compute Policy Went Public

The Launch That Moved Syuchatar: YetiCloud.AI and the Night Nepal’s Compute Policy Went Public

July 4, 2026
Illustrating Sovereign AI Compute in Nepal Syuchatar with circuitary

Syuchatar in Regional Context: A Policy Commentary on Sovereign AI Compute

May 31, 2026
Technical explainer on Nepal's announced Sovereign AI Compute Center at Syuchatar. What Budget 2083/84 specified, what it didn't, and the four design questions that decide its outcome.

Nepal’s Sovereign AI Compute Center at Syuchatar: A Technical Explainer

May 30, 2026
Hostinger
  • News
  • Tech
  • Event
Generate free QR Codes with QRSansar

TechSansar.com, ICT For Media Pvt Ltd, Regd #249079/077/078, VAT #609868175.
By continuing to use this site, you agree to our cookies and privacy policies.
Here is our Do Not Track (DNT) Guide. Hosted on a VPS and uses this free PDF tool. You can also subscribe to our newsletter.
Creating tech contents for the b̶o̶t̶s̶ humans since 2009 • Team TechSansar • ICT4M with ❤ from Nepal

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms below to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • Home page
  • Shop peripherals
  • Buy software
  • Featured articles
  • My account

TechSansar.com, ICT For Media Pvt Ltd, Regd #249079/077/078, VAT #609868175.
By continuing to use this site, you agree to our cookies and privacy policies.
Here is our Do Not Track (DNT) Guide. Hosted on a VPS and uses this free PDF tool. You can also subscribe to our newsletter.
Creating tech contents for the b̶o̶t̶s̶ humans since 2009 • Team TechSansar • ICT4M with ❤ from Nepal