mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-05 20:49:09 -04:00
Create Item_Model::thumb_tag() and Item_Model::resize_tag() to provide
an abstraction for when we add movie support.
This commit is contained in:
@@ -253,4 +253,30 @@ class Item_Model extends ORM_MPTT {
|
||||
->where("id <=", $child_id)
|
||||
->count_all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an <img> tag for the thumbnail.
|
||||
* @param array $extra_attrs Extra attributes to add to the img tag
|
||||
* @return string
|
||||
*/
|
||||
public function thumb_tag($extra_attrs) {
|
||||
return html::image(array("src" => $this->thumb_url(),
|
||||
"alt" => $this->title,
|
||||
"width" => $this->thumb_width,
|
||||
"height" => $this->thumb_height),
|
||||
$extra_attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an <img> tag for the thumbnail.
|
||||
* @param array $extra_attrs Extra attributes to add to the img tag
|
||||
* @return string
|
||||
*/
|
||||
public function resize_tag($extra_attrs) {
|
||||
return html::image(array("src" => $this->resize_url(),
|
||||
"alt" => $this->title,
|
||||
"width" => $this->resize_width,
|
||||
"height" => $this->resize_height),
|
||||
$extra_attrs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
<li id="gItemId-<?= $child->id ?>" class="gItem <?= $item_class ?>">
|
||||
<?= $theme->thumb_top($child) ?>
|
||||
<a href="<?= $child->url() ?>">
|
||||
<img class="gThumbnail"
|
||||
src="<?= $child->thumb_url() ?>"
|
||||
alt="<?= $child->title ?>"
|
||||
width="<?= $child->thumb_width ?>"
|
||||
height="<?= $child->thumb_height ?>" />
|
||||
<?= $child->thumb_tag(array("class" => "gThumbnail")) ?>
|
||||
</a>
|
||||
<?= $theme->thumb_bottom($child) ?>
|
||||
<h2><a href="<?= $child->url() ?>"><?= $child->title ?></a></h2>
|
||||
|
||||
@@ -12,11 +12,7 @@
|
||||
<? endif ?>
|
||||
</ul>
|
||||
|
||||
<img id="gPhotoId-<?= $item->id ?>"
|
||||
src="<?= $item->resize_url() ?>"
|
||||
alt="<?= $item->title ?>"
|
||||
width="<?= $item->resize_width ?>"
|
||||
height="<?= $item->resize_height ?>" />
|
||||
<?= $item->resize_tag(array("id" => "gPhotoId-{$item->id}")) ?>
|
||||
|
||||
<div id="gInfo">
|
||||
<h1><?= $item->title ?></h1>
|
||||
|
||||
Reference in New Issue
Block a user