Ejemplo n.º 1
0
/**
 * Prints a link to a custom sized thumbnail of the current album
 *
 * See getCustomImageURL() for details.
 *
 * @param string $alt Alt atribute text
 * @param int $size size
 * @param int $width width
 * @param int $height height
 * @param int $cropw cropwidth
 * @param int $croph crop height
 * @param int $cropx crop part x axis
 * @param int $cropy crop part y axis
 * @param string $class css class
 * @param string $id css id
 *
 * @return string
 */
function printCustomAlbumThumbImage($alt, $size, $width = NULL, $height = NULL, $cropw = NULL, $croph = NULL, $cropx = NULL, $cropy = null, $class = NULL, $id = NULL)
{
    global $_zp_current_album;
    if (!$_zp_current_album->getShow()) {
        $class .= " not_visible";
    }
    $pwd = $_zp_current_album->getPassword();
    if (!empty($pwd)) {
        $class .= " password_protected";
    }
    $class = trim($class);
    /* set the HTML image width and height parameters in case this image was "imageDefault.png" substituted for no thumbnail then the thumb layout is preserved */
    $sizing = '';
    if (is_null($width)) {
        if (!is_null($cropw) && !is_null($croph)) {
            if (empty($height)) {
                $height = $size;
            }
            $s = round($height * ($cropw / $croph));
            if (!empty($s)) {
                $sizing = ' width="' . $s . '"';
            }
        }
    } else {
        $sizing = ' width="' . $width . '"';
    }
    if (is_null($height)) {
        if (!is_null($cropw) && !is_null($croph)) {
            if (empty($width)) {
                $width = $size;
            }
            $s = round($width * ($croph / $cropw));
            if (!empty($s)) {
                $sizing = $sizing . ' height="' . $s . '"';
            }
        }
    } else {
        $sizing = $sizing . ' height="' . $height . '"';
    }
    if (!getOption('use_lock_image') || $_zp_current_album->isMyItem(LIST_RIGHTS) || empty($pwd)) {
        $html = '<img src="' . html_encode(pathurlencode(getCustomAlbumThumb($size, $width, $height, $cropw, $croph, $cropx, $cropy))) . '"' . $sizing . ' alt="' . html_encode($alt) . '"' . ($class ? ' class="' . $class . '"' : '') . ($id ? ' id="' . $id . '"' : '') . " />";
        $html = zp_apply_filter('custom_album_thumb_html', $html);
        echo $html;
    } else {
        echo getPasswordProtectImage($sizing);
    }
}
/**
 * Prints a link to a custom sized thumbnail of the current album
 *
 * @param string $alt Alt atribute text
 * @param int $size size
 * @param int $width width
 * @param int $height height
 * @param int $cropw cropwidth
 * @param int $croph crop height
 * @param int $cropx crop part x axis
 * @param int $cropy crop part y axis
 * @param string $class css class
 * @param string $id css id
 *
 * @return string
 */
function printCustomAlbumThumbImage($alt, $size, $width = NULL, $height = NULL, $cropw = NULL, $croph = NULL, $cropx = NULL, $cropy = null, $class = NULL, $id = NULL)
{
    global $_zp_current_album;
    if (!$_zp_current_album->getShow()) {
        $class .= " not_visible";
    } else {
        $pwd = $_zp_current_album->getPassword();
        if (zp_loggedin() && !empty($pwd)) {
            $class .= " password_protected";
        }
    }
    $class = trim($class);
    /* set the HTML image width and height parameters in case this image was "imageDefault.png" substituted for no thumbnail then the thumb layout is preserved */
    if ($sizeW = max(is_null($width) ? 0 : $width, is_null($cropw) ? 0 : $cropw)) {
        $sizing = ' width="' . $sizeW . '"';
    } else {
        $sizing = null;
    }
    if ($sizeH = max(is_null($height) ? 0 : $height, is_null($croph) ? 0 : $croph)) {
        $sizing = $sizing . ' height="' . $sizeH . '"';
    }
    if (!getOption('use_lock_image') || checkAlbumPassword($_zp_current_album->name, $hint)) {
        echo "<img src=\"" . htmlspecialchars(getCustomAlbumThumb($size, $width, $height, $cropw, $croph, $cropx, $cropy)) . "\"" . $sizing . " alt=\"" . html_encode($alt) . "\"" . ($class ? " class=\"{$class}\"" : "") . ($id ? " id=\"{$id}\"" : "") . " />";
    } else {
        echo getPasswordProtectImage($sizing);
    }
}