Adding watermarks with image overlays

CodeIgniter can add watermarks with text as detailed in the preceding recipe, but CodeIgniter can also by overlaying a watermark image on top of a base image. Here's how it's done…

Getting ready

We're going to use a library of our own for this. If you haven't already done so (in the other recipes in this chapter), create the following file:

  • /path/to/codeigniter/application/libraries/image_manip.php
  1. Ensure that the image_manip library class is defined as follows:
    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    class Image_manip {
  2. This recipe is based on the Adding watermarks with text recipe. Make sure you have followed that recipe first. We're going to make a few code changes to it to ...

Get CodeIgniter 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.