public function PHPVideoToolkit::addWatermark in Video 7.2
Same name and namespace in other branches
- 7 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.:
string $vhook The absolute path to the ffmpeg vhook watermark library.:
string $watermark_options Any additional options to supply to the vhook.:
File
- libraries/
phpvideotoolkit/ phpvideotoolkit.php5.php, line 2035 - Libary to access FFmpeg
Class
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
// vhook depricated so now we have to ues http://ffmpeg.org/libavfilter.html
$file_input_switch = preg_match("/watermark.*/", $vhook) ? ' -f ' : ' -i ';
$this
->addCommand('-vhook', $vhook . $file_input_switch . $watermark_url . ($watermark_options !== FALSE ? ' ' . $watermark_options : ''));
}