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

Re: using image size functions in ePerl



El Tue, Nov 02, 1999 at 10:04:24AM +0100, Denis Barbier contaba:
>The simplest is to install this module into the standard Perl location.
>If you have WML sources, go to wml_common/imagesize, otherwise download
>it from
>http://www.perl.com/CPAN-local/modules/by-module/Image/Image-Size-2.901.tar.gz
>or any mirror and untar it. Then run
>   perl Makefile.PL
>   make
>   su
>   make install

Well, finally I decided to check the 'htmlfix' code to see how do
they manage to use this functions and I arrived to this clean an
pretty solution.

---------------------------------------------------
#use wml::std::tags

<define-tag img-size whitespace=delete>
<preserve img>
<preserve return>
<set-var %attributes>
<:
use lib "/usr/lib/wml/perl/lib";
use lib "/usr/lib/wml/perl/lib/i386-linux/5.004";

use Image::Size;

($hor,$ver,$type) = imgsize("<get-var img>");

if ("<get-var return>" eq "hor") 
           { print $hor ; } 
           
if ("<get-var return>" eq "ver") 
           { print $ver; }  
           
if ("<get-var return>" eq "type") 
           { print $type; }  

:>
</define-tag>

This image is a <img-size img="xose.jpg" return="type"> 
( <img-size img="xose.jpg" return="hor"> 
x 
<img-size img="xose.jpg" return="ver">)

--------------------------------------------

The answer is simply the 'use lib .....'. (Pretty simple). 

Maybe somebody finds of any use this little 'tag' I have created.


-- 
Saudos:
><ose        xmanoel@bigfoot.com   (Vigo/Galicia/Espaņa)
         http://pagina.de/xmanoel/
         http://w3.to/mikkeli/

______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com