[interchange-cvs] interchange - jon modified
code/SystemTag/image.tag
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Mon Nov 7 18:30:16 EST 2005
User: jon
Date: 2005-11-07 23:30:15 GMT
Modified: code/SystemTag image.tag
Log:
A patch from Ethan Rowe <ethan at endpoint.com>:
Add a new "size_scratch_prefix" argument to the [image] tag. If
"getsize" is in use (which is the default), passing a value for
"size_scratch_prefix" to [image] will result in the height and width
of the image being placed into temporary Scratch-space variables with
names "<size_scratch_prefix>_height" and "<size_scratch_prefix>_width",
respectively. Naturally, if "getsize" is given a perl-false value,
the dimensions will not be found for the image and thus the
"size_scratch_prefix" value is ignored.
(Dumb) Example:
[image src=foo.png size_scratch_prefix=foo]
foo.png has height [scratch foo_height] and width [scratch foo_width]
This kind of thing can be useful for styling control and page layout, as
it allows the application programmer to work with the image dimensions
and adjust markup/styling appropriately in response to those dimensions.
The scratch values created are temporary (i.e. as if they were created
via [tmp ...]) and will not persist in the session past the end of the
current page process.
Revision Changes Path
1.16 +6 -2 interchange/code/SystemTag/image.tag
rev 1.16, prev_rev 1.15
Index: image.tag
===================================================================
RCS file: /var/cvs/interchange/code/SystemTag/image.tag,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -u -r1.15 -r1.16
--- image.tag 15 Oct 2005 00:32:41 -0000 1.15
+++ image.tag 7 Nov 2005 23:30:15 -0000 1.16
@@ -1,12 +1,12 @@
# 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.15 2005/10/15 00:32:41 jon Exp $
+# $Id: image.tag,v 1.16 2005/11/07 23:30:15 jon Exp $
UserTag image Order src
UserTag image AttrAlias geometry makesize
UserTag image AttrAlias resize makesize
UserTag image AddAttr
-UserTag image Version $Revision: 1.15 $
+UserTag image Version $Revision: 1.16 $
UserTag image Routine <<EOR
sub {
my ($src, $opt) = @_;
@@ -234,6 +234,10 @@
my ($width, $height) = Image::Size::imgsize($path);
($opt->{width}, $opt->{height}) = ($width, $height)
if $width and $height;
+ if ($opt->{size_scratch_prefix}) {
+ Vend::Interpolate::set_tmp($opt->{size_scratch_prefix} . '_' . $_, $opt->{$_})
+ for qw/width height/;
+ }
};
}
}
More information about the interchange-cvs
mailing list