global $debugOutput, $useInternalFlvPlayer, $youtubeDevId;
global $width, $height, $externalFlvPlayer, $externalFlvPlayerVars;
global $flvThumbnail, $useRemoteSize, $autoStart;
- global $watermarkVideos, $watermarkImage;
+ global $watermarkVideos, $watermarkImage, $watermarkAlignment;
/* Find out what value our parameters should have by looking to see if they
* are defined in our overrides section or default section. If they are not
$autoStart = $this->getParameter($ItemAddEmbedVideo, 'autoStart', "false");
$watermarkImage = $this->getParameter($ItemAddEmbedVideo, 'watermarkImage', "");
$watermarkVideos = $this->getParameter($ItemAddEmbedVideo, 'watermarkVideos', "false");
+ $watermarkAlignment = $this->getParameter($ItemAddEmbedVideo, 'watermarkAlignment', "center");
/* Print our stored/set Parameters */
if(!strcmp($debugOutput,"true")) {
print "autoStart=$autoStart<br>";
print "watermarkVideos=$watermarkVideos<br>";
print "watermarkImage=$watermarkImage<br>";
+ print "watermarkAlignment=$watermarkAlignment<br>";
print "<hr>";
}
} else {
$watermarkImage = $gallery2_url.$gallery2_video_watermark;
}
-
+
/* Get the watermark Image Extension */
preg_match('/\.(...)$/', $watermarkImage, $matches);
$watermarkExt=$matches[1];
/*
* Check to make sure the URL to the watermark image file is valid
- * (That the file exists at the URL given)
+ * (That the file exists at the URL given). Skip this part if it is a local path.
*/
- list ($successfullyCopied, $response, $headers) =
- $this->fetchWebFileHeaders($watermarkImage, $extraHeaders);
- if (!$successfullyCopied) {
- return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__,
- "Unable to find the watermark image at url: $watermarkImage - $response"),NULL,NULL);
- }
+ if(!preg_match("/^\//", $watermarkImage)) {
+ list ($successfullyCopied, $response, $headers) =
+ $this->fetchWebFileHeaders($watermarkImage, $extraHeaders);
+ if (!$successfullyCopied) {
+ return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__,
+ "Unable to find the watermark image at url: $watermarkImage - $response"),NULL,NULL);
+ }
- /* Download the watermark image to a local file */
- $tmpDir = $gallery->getConfig('data.gallery.tmp');
- $watermark = $platform->tempnam($tmpDir, 'wmk_img_');
- $watermark.= "." . $watermarkExt;
- list ($successfullyCopied, $response, $headers) =
- GalleryCoreApi::fetchWebFile($watermarkImage, $watermark, $extraHeaders);
- if (!$successfullyCopied) {
- return array(GalleryCoreApi::error(ERROR_STORAGE_FAILURE,__FILE__,__LINE__,
- "Unable to copy watermark image from url: $watermarkImage - $response"),null,null);
+ /* Download the watermark image to a local file */
+ $tmpDir = $gallery->getConfig('data.gallery.tmp');
+ $watermark = $platform->tempnam($tmpDir, 'wmk_img_');
+ $watermark.= "." . $watermarkExt;
+ list ($successfullyCopied, $response, $headers) =
+ GalleryCoreApi::fetchWebFile($watermarkImage, $watermark, $extraHeaders);
+ if (!$successfullyCopied) {
+ return array(GalleryCoreApi::error(ERROR_STORAGE_FAILURE,__FILE__,__LINE__,
+ "Unable to copy watermark image from url: $watermarkImage - $response"),null,null);
+ }
+ } else {
+ $tmpDir = $gallery->getConfig('data.gallery.tmp');
+ $watermark = $platform->tempnam($tmpDir, 'wmk_img_');
+ $watermark.= "." . $watermarkExt;
+ if(!$platform->copy($watermarkImage, $watermark)) {
+ return array(GalleryCoreApi::error(ERROR_STORAGE_FAILURE,__FILE__,__LINE__,
+ "Unable to copy watermark image from path: $watermarkImage"),null,null);
+ }
}
/* See if there is a toolkit installed that can perform a composite operation */
/* This has to be done to satisfy the argument requirement for the toolkit operation */
$dataDir = $gallery->getConfig('data.gallery.base');
$dataDir=preg_replace("/\//","\\/",$dataDir);
- preg_match("/$dataDir(.*)/", $watermark, $matches);
- $watermark = $matches[1];
+ if(preg_match("/$dataDir(.*)/", $watermark, $matches)) {
+ $watermark = $matches[1];
+ }
/* General debug output */
if(!strcmp($debugOutput,"true")) {
$mimeType, 'composite', $newTmpFile, $tmpFile,
array($watermark, $watermarkMimeType,
$watermarkWidth, $watermarkHeight,
- 'bottom-left', 0, 0));
+ $watermarkAlignment, 0, 0));
/* Check the return code of the composite operation */
if ($ret) {