X-Git-Url: http://git.pippins.net/embedvideo/.git/%27%20%20%20%20.%20%24GLOBALS%5B%27phpgw%27%5D-%3Elink%28%27inc/jquery/jquery.tablesorter.css%27%29.%27?a=blobdiff_plain;f=ItemAddEmbedVideo.inc;h=4e517acb19a0214542a31360beb9b4d74f835ed1;hb=5e1dae2697864b504a086c160a605cfc8a45b9fa;hp=03a54e94d31d5b2b68e911c9d0ce04c9c6f97c49;hpb=b65625759caa70c8905f63b87a36e59951ed24fd;p=embedvideo%2F.git
diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc
index 03a54e9..4e517ac 100644
--- a/ItemAddEmbedVideo.inc
+++ b/ItemAddEmbedVideo.inc
@@ -70,7 +70,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
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
@@ -89,6 +89,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
$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")) {
@@ -107,6 +108,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
print "autoStart=$autoStart
";
print "watermarkVideos=$watermarkVideos
";
print "watermarkImage=$watermarkImage
";
+ print "watermarkAlignment=$watermarkAlignment
";
print "
";
}
@@ -661,31 +663,41 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
} 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 */
@@ -726,8 +738,9 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
/* 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")) {
@@ -747,7 +760,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
$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) {