fixes the featured block not keeping the image in the sidebar on certain themes

This commit is contained in:
Daku 2012-01-27 05:19:47 +00:00
parent c5468bd938
commit 56f3ca6c10

View file

@ -5,7 +5,7 @@ class FeaturedTheme extends Themelet {
* Show $text on the $page
*/
public function display_featured(Page $page, Image $image) {
$page->add_block(new Block("Featured Image", $this->build_thumb_html($image), "left", 3));
$page->add_block(new Block("Featured Image", $this->build_featured_html($image), "left", 3));
}
public function get_buttons_html($image_id) {
@ -18,5 +18,25 @@ class FeaturedTheme extends Themelet {
</form>
";
}
public function build_featured_html(Image $image, $query=null) {
global $config;
$i_id = int_escape($image->id);
$h_view_link = make_link("post/view/$i_id", $query);
$h_thumb_link = $image->get_thumb_link();
$h_tip = html_escape($image->get_tooltip());
$tsize = get_thumbnail_size($image->width, $image->height);
return "
<center><div>
<a href='$h_view_link' style='position: relative; height: {$tsize[1]}px; width: {$tsize[0]}px;'>
<img id='thumb_$i_id' title='$h_tip' alt='$h_tip' class='highlighted' style='height: {$tsize[1]}px; width: {$tsize[0]}px;' src='$h_thumb_link'>
</a>
</div></center>
";
}
}
?>