aboutsummaryrefslogtreecommitdiff
path: root/actions/upload.php
diff options
context:
space:
mode:
authorGreg Froese <greg.froese@gmail.com>2009-05-12 13:52:21 +0000
committerGreg Froese <greg.froese@gmail.com>2009-05-12 13:52:21 +0000
commit36dbbe5be6781b3816283a35054067c99bb5cc10 (patch)
tree134e875f88f0b51067fd7dc3efd603eaf781c149 /actions/upload.php
parent7e944576f4bce2fb95718d0a233af438a7bf9cd8 (diff)
downloadelgg-36dbbe5be6781b3816283a35054067c99bb5cc10.tar.gz
elgg-36dbbe5be6781b3816283a35054067c99bb5cc10.tar.bz2
added watermark option and re-enabled the code for watermarks if one is set in settings
Diffstat (limited to 'actions/upload.php')
-rw-r--r--actions/upload.php50
1 files changed, 23 insertions, 27 deletions
diff --git a/actions/upload.php b/actions/upload.php
index 3049d027d..797a4dfce 100644
--- a/actions/upload.php
+++ b/actions/upload.php
@@ -156,41 +156,37 @@
$thumb->setFilename($prefix."largethumb".$filestorename);
$file->largethumb = $prefix."largethumb".$filestorename;
}
-
- }
-
-/*
- $watermark = true; //gfroese - this should come from the plugin settings
- $watermark_text = $username . " - shutterpeg.com";
- if( $watermark ) { //get this value from the plugin settings
- if( $thumblarge ) {
- $ext = ".png";
- $user_stamp_base = dirname(__FILE__) . "/" . $username . "_stamp";
- if( !file_exists( $user_stamp_base . $ext )) { //create the watermark if it doesn't exist
+
+ $watermark_text = get_plugin_setting('watermark_text', 'tidypics');
+ if( $watermark_text ) { //get this value from the plugin settings
+ if( $thumblarge ) {
+ $ext = ".png";
+ $user_stamp_base = dirname(__FILE__) . "/" . $username . "_stamp";
+ if( !file_exists( $user_stamp_base . $ext )) { //create the watermark if it doesn't exist
+ $commands = array();
+ $commands[] = 'convert -size 300x50 xc:grey30 -pointsize 20 -gravity center -draw "fill grey70 text 0,0 \''. $watermark_text . '\'" '. $user_stamp_base . '_fgnd' . $ext;
+ $commands[] = 'convert -size 300x50 xc:black -pointsize 20 -gravity center -draw "fill white text 1,1 \''. $watermark_text . '\' text 0,0 \''. $watermark_text . '\' fill black text -1,-1 \''. $watermark_text . '\'" +matte ' . $user_stamp_base . '_mask' . $ext;
+ $commands[] = 'composite -compose CopyOpacity ' . $user_stamp_base . "_mask" . $ext . ' ' . $user_stamp_base . '_fgnd' . $ext . ' ' . $user_stamp_base . $ext;
+ $commands[] = 'mogrify -trim +repage ' . $user_stamp_base . $ext;
+ $commands[] = 'rm ' . $user_stamp_base . '_mask' . $ext;
+ $commands[] = 'rm ' . $user_stamp_fgnd . '_mask' . $ext;
+
+ foreach( $commands as $command ) {
+ file_put_contents("/home/gfroese/debug.txt", $command . "\n", FILE_APPEND);
+ exec( $command );
+ }
+ }
+ //apply the watermark
$commands = array();
- $commands[] = 'convert -size 300x50 xc:grey30 -pointsize 20 -gravity center -draw "fill grey70 text 0,0 \''. $watermark_text . '\'" '. $user_stamp_base . '_fgnd' . $ext;
- $commands[] = 'convert -size 300x50 xc:black -pointsize 20 -gravity center -draw "fill white text 1,1 \''. $watermark_text . '\' text 0,0 \''. $watermark_text . '\' fill black text -1,-1 \''. $watermark_text . '\'" +matte ' . $user_stamp_base . '_mask' . $ext;
- $commands[] = 'composite -compose CopyOpacity ' . $user_stamp_base . "_mask" . $ext . ' ' . $user_stamp_base . '_fgnd' . $ext . ' ' . $user_stamp_base . $ext;
- $commands[] = 'mogrify -trim +repage ' . $user_stamp_base . $ext;
- $commands[] = 'rm ' . $user_stamp_base . '_mask' . $ext;
- $commands[] = 'rm ' . $user_stamp_fgnd . '_mask' . $ext;
-
+ $commands[] = 'composite -gravity south -geometry +0+10 ' . $user_stamp_base . $ext . ' ' . $thumblarge . ' ' . $thumblarge . '_watermarked';
+ $commands[] = "mv $thumblarge" . "_watermarked $thumblarge";
foreach( $commands as $command ) {
file_put_contents("/home/gfroese/debug.txt", $command . "\n", FILE_APPEND);
exec( $command );
}
}
- //apply the watermark
- $commands = array();
- $commands[] = 'composite -gravity south -geometry +0+10 ' . $user_stamp_base . $ext . ' ' . $thumblarge . ' ' . $thumblarge . '_watermarked';
- $commands[] = "mv $thumblarge" . "_watermarked $thumblarge";
- foreach( $commands as $command ) {
- file_put_contents("/home/gfroese/debug.txt", $command . "\n", FILE_APPEND);
- exec( $command );
- }
}
}
-*/
} else { //file exceeds file size limit, so delete it
$file->delete();
array_push($not_uploaded, $name);