Revision [16703]
This is an old revision of EnhancedImageAction made by MnqA5u on 2007-05-31 10:38:21.
Enhanced Image Action
See also:
Documentation: EnhancedImageActionInfo.The code here below is just a quick modification to the offical image action code. Only works from release 1.1.6.0!
%%(php)
<?php
function to check if a string is a valid Length as specified in the XHTML DTDs
if (!function_exists('is_length')) {
function is_length($input) {
return preg_match("/^[0-9] \%?$/",$input) ? TRUE : FALSE;
}
}setting default values
$link = $class = $output = $title = $width = $height = NULL;
getting the paramters
if (is_array($vars))
{
foreach ($vars as $param => $value)
{
if ($param
'src' and $vars['url']
) {$vars['url']=$value;}
if ($param
'class') {$class=$this->htmlspecialchars_ent($vars['class']);}
if ($param
'width') {$width=$this->htmlspecialchars_ent($vars['width']);}
if ($param
'link') {$link=$this->cleanUrl(trim($vars['link']));}
}
}sanatizing url and proofing if it is an image
$url = $this->cleanUrl(trim($vars['url']));
$image = getimagesize($url);
if it is an image, prepare the output
if ((is_array($image))