protected function BackgroundImage()
{
if (!$this->back_image) {
return '';
}
$image = array('width' => $this->back_image_width, 'height' => $this->back_image_height, 'x' => $this->back_image_left, 'y' => $this->back_image_top, 'xlink:href' => $this->back_image, 'preserveAspectRatio' => $this->back_image_mode == 'stretch' ? 'none' : 'xMinYMin');
$style = array();
if ($this->back_image_opacity) {
$style['opacity'] = $this->back_image_opacity;
}
$contents = '';
if ($this->back_image_mode == 'tile') {
$image['x'] = 0;
$image['y'] = 0;
$im = $this->Element('image', $image, $style);
$pattern = array('id' => $this->NewID(), 'width' => $this->back_image_width, 'height' => $this->back_image_height, 'x' => $this->back_image_left, 'y' => $this->back_image_top, 'patternUnits' => 'userSpaceOnUse');
// tiled image becomes a pattern to replace background colour
$this->defs[] = $this->Element('pattern', $pattern, NULL, $im);
$this->back_colour = "url(#{$pattern['id']})";
} else {
$im = $this->Element('image', $image, $style);
$contents .= $im;
}
return $contents;
}