How to Write Text on a Image Using PHP

Best WordPress Hosting
Sometimes, we need to add watermarks on the images. This is the best way to show your copyright on the images. If the photos are uploaded by users, it is not possible to add text on the images manually. But it is necessary to protect images by adding a watermark. In PHP, it is easy to add a water mark on the images. You can either add your logo or copyright text as watermark on the image. In this tutorial, I will show you how you can write some text on an image at a specific position. This can be done with the php function imageString. This is simple if you know how to use the function.

See the code below and try it. In this code, I am adding my name DeepankerĀ on a image called welcome.jpeg.

Try this code and let me know if there is any problem in the code.

You can improve this code to adopt the height and width of the images. For this first grab the image dimensions and then adjust your watermark according to it. See this tutorial for advance watermarking technique.

advertisement

About The Author

  • ADD YOUR COMMENT

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Receive fresh web design resources and SEO tips in your email by our weekly newsletter

You have Successfully Subscribed!