Image WaterMarking with Codeigniter

oleh -559 Dilihat

Image watermarking is generally used for branding, for copyright text and so on. Images can be easily watermarked in CodeIgniter by using CI’s image manipulation class. The Watermarking feature requires the GD/GD2 library. This article will show you how to go about it.

Firstly, you have to load the image_lib library in your controller.

Syntax:

Once loaded, the image library object is available using:

This library helps you to resize, crop, rotate, create thumbnail and watermark your images, but we will only check out watermarking here.

In CodeIgniter, there are two types of watermarking that you can use, with small configurations changes;

1. Text watermark.(wm_text)
Codeigniter text watermark message will be generated using text, either with a True Type font that you specify, or using the native text output that the GD library supports.

2. Image overlay watermark.(wm_overlay_path)
Codeigniter image watermark message will be generated by overlaying an image (usually a transparent PNG or GIF) containing your watermark over the uploaded source image.


You can check out the watermarking preferences and their descriptions here:
https://www.codeigniter.com/userguide3/libraries/image_lib.html
Here is a full Example of Image Watermark:

No More Posts Available.

No more pages to load.