[interchange] Fix for image.tag when using makesize and extra parameters

Jon Jensen <[email protected]>
Newsgroups gmane.comp.web.interchange.cvs
Message-ID <[email protected]>
commit a1d2dcefef7b292b200981ce8a652661ff4ace19
Author: Josh Lavin <[email protected]>
Date:   Tue Mar 15 16:43:15 2011 -0500

    Fix for image.tag when using makesize and extra parameters
    
    Example: makesize="200>".
    
    Also quote argument for execution.

 code/SystemTag/image.tag |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/code/SystemTag/image.tag b/code/SystemTag/image.tag
index 35c0bc7..7512f88 100644
--- a/code/SystemTag/image.tag
+++ b/code/SystemTag/image.tag
@@ -1,4 +1,4 @@
-# Copyright 2002-2010 Interchange Development Group and others
+# Copyright 2002-2011 Interchange Development Group and others
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -9,7 +9,7 @@ UserTag image Order     src
 UserTag image AttrAlias geometry makesize
 UserTag image AttrAlias resize makesize
 UserTag image AddAttr
-UserTag image Version   $Revision: 1.24 $
+UserTag image Version   1.25
 UserTag image Routine   <<EOR
 sub {
 	my ($src, $opt) = @_;
@@ -171,7 +171,8 @@ sub {
 						last MOGIT;
 					};
 
-				$dir .= "/$siz";
+				(my $siz_path = $siz) =~ s:[^\dx]::g;
+				$dir .= "/$siz_path";
 				
 				my $newpath = "$dir/$fn";
 				if(-f $newpath) {
@@ -179,13 +180,13 @@ sub {
 						my $mod1 = -M $newpath;
 						my $mod2 = -M $path;
 						unless ($mod2 < $mod1) {
-							$image =~ s:(/?)([^/]+$):$1$siz/$2:;
+							$image =~ s:(/?)([^/]+$):$1$siz_path/$2:;
 							$path = $newpath;
 							last MOGIT;
 						}
 					}
 					else {
-						$image =~ s:(/?)([^/]+$):$1$siz/$2:;
+						$image =~ s:(/?)([^/]+$):$1$siz_path/$2:;
 						$path = $newpath;
 						last MOGIT;
 					}
@@ -218,7 +219,7 @@ sub {
 					}
 				}
 				last MOGIT unless $exec;
-				system "$exec -geometry $siz '$newpath'";
+				system qq{$exec -geometry "$siz" '$newpath'};
 				if($?) {
 					logError("%s: Unable to mogrify image '%s'", 'image tag', $newpath);
 					last MOGIT;
@@ -228,7 +229,7 @@ sub {
 					rename $mgkpath, $newpath
 						or die "Could not overwrite image with new one!";
 				}
-				$image =~ s:(/?)([^/]+$):$1$siz/$2:;
+				$image =~ s:(/?)([^/]+$):$1$siz_path/$2:;
 				$path = $newpath;
 			}
 		}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.