diff options
author | Greg Froese <greg.froese@gmail.com> | 2009-05-13 19:06:38 +0000 |
---|---|---|
committer | Greg Froese <greg.froese@gmail.com> | 2009-05-13 19:06:38 +0000 |
commit | 711c6040d3a5e3b479a1326c5afc6c3a689c8ad5 (patch) | |
tree | 88fb21fbcf59950994d97c58c40ddbfdcbd8d204 /actions/upload.php | |
parent | bc21cbc465d9cd4d86265246826ba02515541152 (diff) | |
download | elgg-711c6040d3a5e3b479a1326c5afc6c3a689c8ad5.tar.gz elgg-711c6040d3a5e3b479a1326c5afc6c3a689c8ad5.tar.bz2 |
made path to imagemagick a setting
Diffstat (limited to 'actions/upload.php')
-rw-r--r-- | actions/upload.php | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/actions/upload.php b/actions/upload.php index f114f50ad..eeb68aba1 100644 --- a/actions/upload.php +++ b/actions/upload.php @@ -178,6 +178,12 @@ $file->largethumb = $prefix."largethumb".$filestorename;
}
+ $im_path = get_plugin_setting('convert_command', 'tidypics');
+ if(!$im_path) {
+ $im_path = "/usr/bin/";
+ }
+ if(substr($im_path, strlen($im_path)-1, 1) != "/") $im_path .= "/";
+
$watermark_text = get_plugin_setting('watermark_text', 'tidypics');
if( $watermark_text ) { //get this value from the plugin settings
if( $thumblarge ) {
@@ -191,24 +197,22 @@ $user_stamp_base = dirname(__FILE__) . "/" . $viewer->name . "_" . $watermark_filename . "_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[] = $im_path . 'convert -size 300x50 xc:grey30 -pointsize 20 -gravity center -draw "fill grey70 text 0,0 \''. $watermark_text . '\'" '. $user_stamp_base . '_fgnd' . $ext;
+ $commands[] = $im_path . '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[] = $im_path . 'composite -compose CopyOpacity ' . $user_stamp_base . "_mask" . $ext . ' ' . $user_stamp_base . '_fgnd' . $ext . ' ' . $user_stamp_base . $ext;
+ $commands[] = $im_path . '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[] = 'composite -gravity south -geometry +0+10 ' . $user_stamp_base . $ext . ' ' . $thumblarge . ' ' . $thumblarge . '_watermarked';
+ $commands[] = $im_path . '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 );
}
}
|