ion;
if (!$version) {
return;
}
switch($size) {
case 'small':
$this->src = $this->small_src;
$this->width = $version->small_x;
$this->height = $version->small_y;
break;
case 'medium':
$this->src = $this->medium_src;
$this->width = $version->medium_x;
$this->height = $version->medium_y;
break;
case 'normal':
case 'large':
$this->src = $this->normal_src;
$this->width = $version->normal_x;
$this->height = $version->normal_y;
break;
default:
if ($version->is_raw) {
$this->src = $this->normal_src;
$this->width = $version->normal_x;
$this->height = $version->normal_y;
} else {
$this->src = $this->medium_src;
$this->width = $version->medium_x;
$this->height = $version->medium_y;
}
}
if ($x && $y) {
if ($x / $y < $this->width / $this->height) {
// limited by width
$this->height = intval($this->height * $x / $this->width);
$this->width = $x;
} else {
// limited by height
$this->width = intval($this->width * $y / $this->height);
$this->height = $y;
}
}
}
private $_status_icons = null;
function get_status_icons()
{
if ($this->_status_icons === null) {
$_ = $this->getModel()->Node->getStrings();
$icons = array();
if ($this->locked) {
$icons[] = array('type' => 'locked',
'label' => $_->IMAGE_LOCKED);
}
if (!$this->published) {
$icons[] = array('type' => 'draft',
'label' => $_->IMAGE_UNPUBLISHED);
}
if ($this->hidden) {
$icons[] = array('type' => 'hidden',
'label' => $_->IMAGE_HIDDEN);
}
$this->_status_icons = $icons;
}
return $this->_status_icons;
}
function isPublic()
{
if (!$this->published || $this->locked) {
return false;
}
return $this->gallery->isPublic();
}
}
?>