imageSrc) { $widget = $this->widget; // optionally construct link tag. $openLink = $closeLink = ""; if ($widget->getConfig('link')) { $href = $this->escape($widget->getConfig('link')); $target = $this->escapeAttr($widget->getConfig('linkTarget')); if ($target == '_lightbox') { $target = ""; $click = "new p4cms.ui.LightBox({href:this.href}).startup(); return false;"; $openLink = ""; } else { $openLink = ""; } // ensure the link we crafted points at the active branch $branchify = new P4Cms_Filter_BranchifyUrls; $openLink = $branchify->filter($openLink); $closeLink = ''; } // build image markup (div or img) $src = $this->escape($this->imageSrc); $alt = $this->escapeAttr($widget->getConfig('imageAlt')); $title = $this->escapeAttr($widget->getValue('title')); $width = $this->escapeAttr($widget->getConfig('imageWidth')); $height = $this->escapeAttr($widget->getConfig('imageHeight')); $margin = (int) $widget->getConfig('margin'); $margin = $margin ? "margin: " . $margin . "px;" : ""; if ($widget->getConfig('asBackground')) { $title = $alt ?: $title; $image = ""; } else { $image = "\"$alt\""; } // if image alignment is specified, wrap the image with a div and set the text-align attribute $align = $widget->getConfig('alignment', ''); $align = $align === 'none' ? '' : $align; $openWrapper = $align ? '
' : ''; $closeWrapper = $align ? '
' : ''; print $openWrapper . $openLink . $image . $closeLink . $closeWrapper; } else { print "No image to display."; } ?>