diff options
-rw-r--r-- | actions/resize.php | 7 | ||||
-rw-r--r-- | actions/upload.php | 18 | ||||
-rw-r--r-- | languages/en.php | 1 | ||||
-rw-r--r-- | views/default/settings/tidypics/edit.php | 7 |
4 files changed, 25 insertions, 8 deletions
diff --git a/actions/resize.php b/actions/resize.php index 5dfc30975..1c3bf2bad 100644 --- a/actions/resize.php +++ b/actions/resize.php @@ -93,7 +93,12 @@ $newheight = $maxheight; $newwidth = $maxwidth; } - $command = "convert $input_name -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." $output_name"; + $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 .= "/"; + $command = $im_path . "convert $input_name -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." $output_name"; system($command); return $output_name; 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 );
}
}
diff --git a/languages/en.php b/languages/en.php index edf053aa5..5198817b9 100644 --- a/languages/en.php +++ b/languages/en.php @@ -21,6 +21,7 @@ 'item:object:album' => "Albums",
'tidypics:settings:maxfilesize' => "Maximum file size in kilo bytes (KB):",
'tidypics:settings:watermark' => "Enter text to appear in the watermark - ImageMagick must be selected for the image library",
+ 'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands",
'tidypics:enablephotos' => 'Enable Group Photo Albums',
'tidypics:editprops' => 'Edit Image Properties',
'tidypics:mostviewed' => 'Most viewed images',
diff --git a/views/default/settings/tidypics/edit.php b/views/default/settings/tidypics/edit.php index 98f348699..dd2444ac3 100644 --- a/views/default/settings/tidypics/edit.php +++ b/views/default/settings/tidypics/edit.php @@ -15,6 +15,13 @@ 'value' => $image_lib )); ?> + <br /> + <?php + $im_path = $vars['entity']->im_path; + if(!$im_path) $im_path = "/usr/bin/"; + ?> + <?php echo elgg_echo('tidypics:settings:im_path'); ?> + <?php echo elgg_view('input/text', array('internalname' => 'params[im_path]', 'value' => $im_path)); ?> </p> <?php |