Revision [16703]

This is an old revision of EnhancedImageAction made by MnqA5u on 2007-05-31 10:38:21.

 

Enhanced Image Action


This is the development page for the enhanced image action.
 



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
'title') {$title=$this->htmlspecialchars_ent($vars['title']);} if ($param
'class') {$class=$this->htmlspecialchars_ent($vars['class']);} if ($param
'alt') {$alt=$this->htmlspecialchars_ent($vars['alt']);} if ($param
'width') {$width=$this->htmlspecialchars_ent($vars['width']);} if ($param
'height') {$height=$this->htmlspecialchars_ent($vars['height']);} 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))
There are 6 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki