add watermark logo to image codeigniter


function of add logo to image

 public function overlay()
    {
        $this->load->library('image_lib');
        $config['image_library'] = 'gd2';
        $config['source_image'] = 'uploads/5a6b7412ec441hh2.jpg';
        $config['wm_type'] = 'overlay';
        $config['wm_overlay_path'] = 'assets/img/logo-blanc.png';
        $config['new_image']      = 'uploads//output.jpg';
        //the overlay image
    $config['wm_opacity'] =70; # 1 not transparent - 100 fully       transparent
    # coordinates of the pixel color on the overlay to make transparent




       $config['wm_x_transp'] =100;
      $config['wm_y_transp'] = 100;
        $config['wm_vrt_alignment'] = 'middle';
        $config['wm_hor_alignment'] = 'center';
         $config['wm_padding'] = '20';

        $this->image_lib->initialize($config);
        if (!$this->image_lib->watermark()) {
            echo $this->image_lib->display_errors();
        } else {
            echo 'Successfully updated image with watermark';
        }
    }