Refactor again. re #40

This commit is contained in:
Sébastien Lucas 2013-04-03 21:10:28 +02:00
parent f5d86b37e5
commit 91cf377d95
2 changed files with 12 additions and 9 deletions

View file

@ -33,7 +33,9 @@ $book->getLinkArray ();
<?php <?php
if ($book->hasCover) { if ($book->hasCover) {
?> ?>
<a href="fetch.php?id=<?php echo $book->id ?>"><img src="fetch.php?id=<?php echo $book->id ?>&amp;height=150" alt="<?php echo localize("i18n.coversection") ?>" /></a> <a href="<?php echo Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml () ?>">
<img src="<?php echo Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, 150)->hrefXhtml () ?>" alt="<?php echo localize("i18n.coversection") ?>" />
</a>
<?php <?php
} }
?> ?>

View file

@ -107,7 +107,7 @@ class Data extends Base {
} }
} }
public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL) public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL)
{ {
global $config; global $config;
@ -120,7 +120,7 @@ class Data extends Base {
{ {
if ($type != "jpg") $urlParam = addURLParameter($urlParam, "type", $type); if ($type != "jpg") $urlParam = addURLParameter($urlParam, "type", $type);
if ($rel == Link::OPDS_THUMBNAIL_TYPE) { if ($rel == Link::OPDS_THUMBNAIL_TYPE) {
$height = "50"; if (is_null ($height)) {
if (preg_match ('/feed.php/', $_SERVER["SCRIPT_NAME"])) { if (preg_match ('/feed.php/', $_SERVER["SCRIPT_NAME"])) {
$height = $config['cops_opds_thumbnail_height']; $height = $config['cops_opds_thumbnail_height'];
} }
@ -128,6 +128,7 @@ class Data extends Base {
{ {
$height = $config['cops_html_thumbnail_height']; $height = $config['cops_html_thumbnail_height'];
} }
}
$urlParam = addURLParameter($urlParam, "height", $height); $urlParam = addURLParameter($urlParam, "height", $height);
} }
$urlParam = addURLParameter($urlParam, "id", $book->id); $urlParam = addURLParameter($urlParam, "id", $book->id);