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

Re: [ic] image.tag in Perl context


Ton Verhagen wrote:
Dear All,

Seems that the image tag behaves differently when used
in Perl context: image dimensions are discarded...


Please observe the following:
[image src='os28004.gif' imagesubdir='items']

Result:
<img src="/standard/images/items/os28004.gif" width="120" height="150">

>> Image dimensions included !


[perl]
        return $Tag->image( 'os28004.gif', {imagesubdir => 'items', } );
[/perl]

Result:
<img src="/standard/images/items/os28004.gif">

>> NO image dimensions !


Some additional logging (after the 'eval') in the image tag shows:
'require' trapped by operation mask at /usr/local/lib/perl5/site_perl/5.8.2/Image/Size.pm line 20.


The operation mask is the wonderful magic of Safe. If you're running things in [perl] or [calc] blocks, and you don't have allowglobal activated, then the eval occurs within a Safe compartment. While the $Tag object is set up with Safe to allow full execution of any methods, it doesn't always work. This is the nature of Safe, and isn't really something that can necessarily be fixed easily within Interchange itself.

So, the image tag issues a "use" or "require" when dimensions have been requested, and that's blocked by Safe.

One possible workaround you could try:
* customize your version of the image tag and comment out the use/require statement that's invoked in this case (around line 234 or so, "require Image::Size"?)
* add a "Require module Image::Size" to your interchange.cfg.

That would ensure that the module was already loaded once IC was processing requests, and the tag code ought to be able to simply call the appropriate subs/methods.

Hope this helps.
- Ethan

--
Ethan Rowe
End Point Corporation
suppressed

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.