[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

p7_htmlfix sugguestion



        Hi!

 Am I too late to send my grats over Ralf's child? I don't hope so :-)

 If you are referencing a picture, you have to use a relative path if
you want wml_p7_htmlfix to add it's width and height-argument
automatically. That can be a PITA if you are using the same pictures in
different pages around your site.

 I tried to fix it, and produced the following diff to clearify what I
meant: What I was trying to achieve is that I define e.g. -D
DOC_ROOT=/home/alfie/WWW at the start, and that each image that has a
leading / in it's reference will be searched starting from that
directory. The only problem I am faced is that I didn't find out how to
pass that argument along to wml_p7_htmlfix. I hope that this a
interesting sugguestion and helps also someone else than me :-)

----------------------------------------------------------------------
--- wml_p7_htmlfix.orig Sat Jun 24 07:45:18 2000
+++ wml_p7_htmlfix      Wed Jul 12 11:10:00 2000
@@ -122,8 +122,12 @@
         }
         if ($width  eq '*' or $width  == -1 or
             $height eq '*' or $height == -1   ) {
-            if (-f $image) {
-                ($Pwidth, $Pheight) = Image::Size::imgsize($image);
+#  Changed on 2000-07-11 by Gerfried Fuchs <alfie@debian.org>
+            $foo = (substr($image, 0, 1) eq "/")
+                   ? $DOC_ROOT.$image :
+                   $image;
+            if (-f $foo) {
+                ($Pwidth, $Pheight) = Image::Size::imgsize($foo);

                 #    width given, height needs completed
                 if ((not ($width  eq '*' or $width  == -1)) and
----------------------------------------------------------------------

 I hope that I did make myself clear a little bit?  It would be great if
something like this could find it's way into the next release.

 This fix would also have a nice side-effect: If that variable is also
available in the eperl-part you can quite easily produce the URL of the
current file by simply substituting $DOC_ROOT with http://what.ever :)

 Have fun!
Alfie
-- 
"There are some micro-organisms that exhibit characteristics of both
plants and animals.  When exposed to light they undergo photosynthesis;
and when the lights go out, they turn into animals.  But then again,
don't we all?"
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com