From 46021855d5924fd54c87f1685a7bc3a64f9773be Mon Sep 17 00:00:00 2001 From: short <> Date: Tue, 14 Oct 2003 12:58:50 +0000 Subject: [PATCH] +icons --- Web.pm | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Web.pm b/Web.pm index a6be6aa..6a2189e 100644 --- a/Web.pm +++ b/Web.pm @@ -27,7 +27,7 @@ use Exporter; sub Wrequire ($); sub Wuse ($@); our $W; -our @EXPORT=qw(&Wrequire &Wuse &a_href &a_href_cz &vskip &img $W &top_dir &top_dir_disk); +our @EXPORT=qw(&Wrequire &Wuse &a_href &a_href_cz &vskip &img ¢erimg $W &top_dir &top_dir_disk); our @ISA=qw(Exporter); BEGIN @@ -453,6 +453,7 @@ my($file_base)=@_; # Known image extension? if ($file_base=~m#$img_variants_re#o) { return $file_base if !wantarray(); + return ($file_base,$file_base) if $file_base!~m#^/#; return (top_dir($file_base),top_dir_disk().$file_base); } @@ -487,16 +488,31 @@ my($file_base)=@_; return ($file_base_uri.".".$ext,$file_base_disk.".".$ext); } -sub img ($$;$) +sub img ($$;%) { -my($file_base,$alt,$attrs)=@_; +my($file_base,$alt,%attr)=@_; my($file_uri,$file_disk)=img_src $file_base; my($width,$height)=Image::Size::imgsize($file_disk); $alt=~s/<[^>]*>//g; $alt=CGI::escapeHTML($alt); - return "\"$alt\""; + my $content="\"$alt\""; + return a_href img_src($attr{"a_href_img"}),$content if $attr{"a_href_img"}; + return a_href $attr{"a_href"},$content if $attr{"a_href"}; + return $content; +} + +sub centerimg +{ + my $r.=""; + $r.=''."\n"; + @_=( [@_] ) if !ref $_[0]; + for (@_) { + $r.="\t".''."\n"; + } + $r.='
'.&{\&img}(@$_).'
'."\n"; + return $r; } sub readfile ($$) -- 1.8.3.1