summaryrefslogtreecommitdiff
path: root/modules/gallery/libraries/Theme_View.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/libraries/Theme_View.php')
-rw-r--r--modules/gallery/libraries/Theme_View.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php
index d6834464..031da6de 100644
--- a/modules/gallery/libraries/Theme_View.php
+++ b/modules/gallery/libraries/Theme_View.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2011 Bharat Mediratta
+ * Copyright (C) 2000-2012 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,9 +43,6 @@ class Theme_View_Core extends Gallery_View {
"page_type" => $page_type,
"page_subtype" => $page_subtype,
"page_title" => null));
- if ($page_type == "collection") {
- $this->set_global("thumb_proportion", $this->thumb_proportion());
- }
if (module::get_var("gallery", "maintenance_mode", 0)) {
if (identity::active_user()->admin) {
@@ -57,12 +54,20 @@ class Theme_View_Core extends Gallery_View {
/**
* Proportion of the current thumb_size's to default
+ * @param object Item_Model (optional) check the proportions for this item
* @return int
*/
- public function thumb_proportion() {
- // @TODO change the 200 to a theme supplied value when and if we come up with an
- // API to allow the theme to set defaults.
- return module::get_var("gallery", "thumb_size", 200) / 200;
+ public function thumb_proportion($item=null) {
+ // By default we have a globally fixed thumbnail size In core code, we just return a fixed
+ // proportion based on the global thumbnail size, but since modules can override that, we
+ // return the actual proportions when we have them.
+ if ($item && $item->has_thumb()) {
+ return max($item->thumb_width, $item->thumb_height) / 200;
+ } else {
+ // @TODO change the 200 to a theme supplied value when and if we come up with an
+ // API to allow the theme to set defaults.
+ return module::get_var("gallery", "thumb_size", 200) / 200;
+ }
}
public function item() {