You are here

public function PHPVideoToolkit::addWatermark in Video 7

Same name and namespace in other branches
  1. 7.2 libraries/phpvideotoolkit/phpvideotoolkit.php5.php \PHPVideoToolkit::addWatermark()

* Adds a watermark to the outputted files. This effects both video and image output. * * @access public *

Parameters

string $watermark_url The absolute path to the watermark image.: * @param string $vhook The absolute path to the ffmpeg vhook watermark library. * @param string $watermark_options Any additional options to supply to the vhook.

File

libraries/phpvideotoolkit/phpvideotoolkit.php5.php, line 2071

Class

PHPVideoToolkit

Code

public function addWatermark($watermark_url, $vhook = PHPVIDEOTOOLKIT_FFMPEG_WATERMARK_VHOOK, $watermark_options = false) {

  // 			check to see if the ffmpeg binary has support for vhooking
  if (!$this
    ->hasVHookSupport()) {
    return $this
      ->_raiseError('addWatermark_vhook_disabled');
  }

  // 			does the file exist?
  if (!is_file($watermark_url)) {
    return $this
      ->_raiseError('addWatermark_img_404', array(
      'watermark' => $watermark_url,
    ));
  }

  //          determine which vhook library is being called and set appropriate input param
  $file_input_switch = preg_match("/watermark.*/", $vhook) ? ' -f ' : ' -i ';
  $this
    ->addCommand('-vhook', $vhook . $file_input_switch . $watermark_url . ($watermark_options !== false ? ' ' . $watermark_options : ''));
}