[interchange-cvs] interchange - docelic modified
code/SystemTag/image.tag
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Tue Nov 9 06:13:04 EST 2004
User: docelic
Date: 2004-11-09 11:13:04 GMT
Modified: code/SystemTag image.tag
Log:
* Changes related to the makesize= parameter
* Added resize= and geometry= aliases
* Expanded a regex, which only accepted an AxB size specification,
to permit complete format that mogrify supports:
AxB, A or xB, followed by up to two +-number offsets, followed by
none or one of @!%><.
URLs have the "%" character encoded: % = %25
Revision Changes Path
1.11 +12 -5 interchange/code/SystemTag/image.tag
rev 1.11, prev_rev 1.10
Index: image.tag
===================================================================
RCS file: /var/cvs/interchange/code/SystemTag/image.tag,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- image.tag 16 Oct 2004 17:59:20 -0000 1.10
+++ image.tag 9 Nov 2004 11:13:04 -0000 1.11
@@ -1,8 +1,10 @@
-# Copyright 2002 Interchange Development Group (http://www.icdevgroup.org/)
+# Copyright 2002, 2004 Interchange Development Group (http://www.icdevgroup.org/)
# Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: image.tag,v 1.10 2004/10/16 17:59:20 docelic Exp $
+# $Id: image.tag,v 1.11 2004/11/09 11:13:04 docelic Exp $
UserTag image Order src
+UserTag image AttrAlias geometry makesize
+UserTag image AttrAlias resize makesize
UserTag image AddAttr
UserTag image Routine <<EOR
sub {
@@ -69,7 +71,9 @@
}
if($opt->{name_only} and $src) {
- return $src =~ /$absurlre/ ? $src : "$imagedircurrent$src";
+ my $ret = $src =~ /$absurlre/ ? $src : "$imagedircurrent$src";
+ $ret =~ s/%(?!25)/%25/g;
+ return $ret;
}
if ($src =~ /$absurlre/) {
@@ -150,8 +154,10 @@
my $fn = $1;
my $siz = $opt->{makesize};
MOGIT: {
- $siz =~ s/\W+//g;
- $siz =~ m{^\d+x\d+$}
+ # Support complete mogrify -geometry syntax
+ # This matches: AxB, A or xB, followed by 0, 1, or 2 [+-]number
+ # specs, followed by none or one of @!%><.
+ $siz =~ m{^(()|\d+())(x\d+\3|x\d+\2|\3)([+-]\d+){0,2}([@!%><])?$}
or do {
logError("%s: Unable to make image with bad size '%s'", 'image tag', $siz);
last MOGIT;
@@ -223,6 +229,7 @@
$image = $imagedircurrent . $image unless
$image =~ /$absurlre/ or substr($image, 0, 1) eq '/';
+ $image =~ s/%(?!25)/%25/g;
return $image if $opt->{src_only};
$opt->{title} = $opt->{alt} if ! defined $opt->{title} and $opt->{alt};
More information about the interchange-cvs
mailing list