Watermark Images with Other Images and Text on the Fly

Let us say you have some images and want to watermark those images with some other gif, jpeg, png images or with some plain text on the fly in PHP.

It actually looks tough but it is very simple. Let us take a real time example of profile picture option we have here at Go4Expert.com where if you visit the contact info tab of your profile you will see a code as follow.

If we already have an image for the user we should check for last updated time and if it is less than a day we just use the existing image and do not update the image with latest information. This is done to cache the image for a day and is updated every 24 hours.

Next we test for a user uploaded profile picture. If user has uploaded a profile picture we need to use the profile picture in our final image and depending on the uploaded image format we create the profile image from the file and then using imagecopyresampled we merge the two images at the desired locations.

The above solution can also be used to watermark the images because standard watermarking procedure of editing the image in a photo-editing application is very time consuming and PHP offers better solution.

You can use the above method to loop through an entire directory to watermark all images in one go.

aoa sir,
this script is for the profile pic of go4expert.com
can i get a generalized code ....which i can use to create my water mark app.
plz tell me what modifications i have to do
waiting for reply ,
regards,
fasi khan

aoa sir,
this script is for the profile pic of go4expert.com
can i get a generalized code ....which i can use to create my water mark app.
plz tell me what modifications i have to do
waiting for reply ,
regards,
fasi khan

Click to expand...

Fasi Khan, this is general script with example taken from is go4expert.com