Revision [5431]

This is an old revision of EnhancedImageAction made by NilsLindenberg on 2005-02-01 12:41:33.

 

Enhances 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.

<?php
/*
    "image" action

    Parameters:
        url     - URL of image to be embedded
        link        - target link for image (optional). Supports URL, WikiName links, InterWiki links etc.
        title       - title text displayed when mouse hovers above image
        class       - a class for the image
        alt     - an alt text
        width       - optional width
        heigth      - optional heigth
        openfull        - if different from nothing it will link to open the full size image in a  new window

*/


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 == 'heigth') {$heigth=$this->htmlspecialchars_ent($vars['heigth']);}
    }
}
$url = $this->cleanUrl(trim($vars['url']));
$output="";

if ($openfull) {$output.="<a href=\"".$url."\" target=\"_blank\" >";}
$output.="<img ";
if ($class) {$output.="class=\"".$class."\" ";}
$output.="src=\"".$url."\" ";
if ($alt) {$output.="alt=\"".$alt."\" ";}
if ($title) {$output.="title=\"".$title."\" ";}
if ($width) {$output.="width=\"".$width."\" ";}
if ($heigth) {$output.="heigth=\"".$heigth."\" ";}
$output.=" />";
if ($openfull) {$output.="<a>";}

// link?
if ($link = $vars['link'])
{
    $output = $this->Link($link, "", $output, 1, 0, 0);
}

$output = $this->ReturnSafeHTML($output);
print($output);

?>


CategoryDevelopment
There are 6 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki