From f7f6cbf04ff2b19535b0d3b9dbd5f4ab41395bfc Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Tue, 4 Jan 2011 00:28:44 -0700 Subject: First info module refactor step: Load item metadata into an array. Loop through this array in the info block view to display loaded data. --- modules/info/helpers/info_block.php | 37 ++++++++++++++++++++++++++++++++++ modules/info/views/info_block.html.php | 33 +++--------------------------- 2 files changed, 40 insertions(+), 30 deletions(-) (limited to 'modules') diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php index 3cbbb12b..97820d84 100644 --- a/modules/info/helpers/info_block.php +++ b/modules/info/helpers/info_block.php @@ -31,6 +31,43 @@ class info_block_Core { $block->css_id = "g-metadata"; $block->title = $theme->item()->is_album() ? t("Album info") : t("Photo info"); $block->content = new View("info_block.html"); + + $info[] = array( + 'label' => t("Title:"), + 'value' => html::purify($theme->item->title) + ); + if ($theme->item->description) { + $info[] = array( + 'label' => t("Description:"), + 'value' => nl2br(html::purify($theme->item->description)) + ); + } + if (!$theme->item->is_album()) { + $info[] = array( + 'label' => t("File name:"), + 'value' => html::clean($theme->item->name)); + } + if ($theme->item->captured) { + $info[] = array( + 'label' => t("Captured:"), + 'value' => gallery::date_time($theme->item->captured) + ); + } + if ($theme->item->owner) { + $display_name = $theme->item->owner->display_name(); + if ($theme->item->owner->url) { + $info[] = array( + 'label' => t("Owner:"), + 'value' => "item->owner->url}\">" . html::clean($display_name) . "" + ); + } else { + $info[] = array( + 'label' => t("Owner:"), + 'value' => html::clean($display_name) + ); + } + } + $block->content->metadata = $info; } break; } diff --git a/modules/info/views/info_block.html.php b/modules/info/views/info_block.html.php index ebe9bd28..88f29a88 100644 --- a/modules/info/views/info_block.html.php +++ b/modules/info/views/info_block.html.php @@ -1,35 +1,8 @@ -- cgit v1.2.3 From 798c876ba1cb5b83f6cd6616b90321e9e527b864 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Tue, 4 Jan 2011 00:40:12 -0700 Subject: Convert the metadata array to be associative. Replaced single with double-quotes. Indenting fixes. --- modules/info/helpers/info_block.php | 48 +++++++++++++++++----------------- modules/info/views/info_block.html.php | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'modules') diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php index 97820d84..f061f7eb 100644 --- a/modules/info/helpers/info_block.php +++ b/modules/info/helpers/info_block.php @@ -31,40 +31,40 @@ class info_block_Core { $block->css_id = "g-metadata"; $block->title = $theme->item()->is_album() ? t("Album info") : t("Photo info"); $block->content = new View("info_block.html"); - - $info[] = array( - 'label' => t("Title:"), - 'value' => html::purify($theme->item->title) - ); + $info["title"] = array( + "label" => t("Title:"), + "value" => html::purify($theme->item->title) + ); if ($theme->item->description) { - $info[] = array( - 'label' => t("Description:"), - 'value' => nl2br(html::purify($theme->item->description)) - ); + $info["description"] = array( + "label" => t("Description:"), + "value" => nl2br(html::purify($theme->item->description)) + ); } if (!$theme->item->is_album()) { - $info[] = array( - 'label' => t("File name:"), - 'value' => html::clean($theme->item->name)); + $info["file_name"] = array( + "label" => t("File name:"), + "value" => html::clean($theme->item->name) + ); } if ($theme->item->captured) { - $info[] = array( - 'label' => t("Captured:"), - 'value' => gallery::date_time($theme->item->captured) - ); + $info["captured"] = array( + "label" => t("Captured:"), + "value" => gallery::date_time($theme->item->captured) + ); } if ($theme->item->owner) { $display_name = $theme->item->owner->display_name(); if ($theme->item->owner->url) { - $info[] = array( - 'label' => t("Owner:"), - 'value' => "item->owner->url}\">" . html::clean($display_name) . "" - ); + $info["owner"] = array( + "label" => t("Owner:"), + "value" => "item->owner->url}\">" . html::clean($display_name) . "" + ); } else { - $info[] = array( - 'label' => t("Owner:"), - 'value' => html::clean($display_name) - ); + $info["owner"] = array( + "label" => t("Owner:"), + "value" => html::clean($display_name) + ); } } $block->content->metadata = $info; diff --git a/modules/info/views/info_block.html.php b/modules/info/views/info_block.html.php index 88f29a88..7c162767 100644 --- a/modules/info/views/info_block.html.php +++ b/modules/info/views/info_block.html.php @@ -2,7 +2,7 @@ -- cgit v1.2.3 From dbff45cc91ac44f18ef02b8abdd220a2864f050f Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Tue, 4 Jan 2011 15:56:16 -0700 Subject: Add an info_block_metadata event to allow other modules to add to the item info block. --- modules/info/helpers/info_block.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules') diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php index f061f7eb..e3ae1d71 100644 --- a/modules/info/helpers/info_block.php +++ b/modules/info/helpers/info_block.php @@ -68,6 +68,8 @@ class info_block_Core { } } $block->content->metadata = $info; + + module::event("info_block_metadata", $block, $theme->item->id); } break; } -- cgit v1.2.3 From 1d2e583c3177aa498abd70dde442d767efc4e99e Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Tue, 4 Jan 2011 19:25:02 -0700 Subject: Pass the whole item, not just it's ID, to the info_block_metadata event. --- modules/info/helpers/info_block.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php index e3ae1d71..064c73b2 100644 --- a/modules/info/helpers/info_block.php +++ b/modules/info/helpers/info_block.php @@ -69,7 +69,7 @@ class info_block_Core { } $block->content->metadata = $info; - module::event("info_block_metadata", $block, $theme->item->id); + module::event("info_block_metadata", $block, $theme->item); } break; } -- cgit v1.2.3 From 2e5d4a59b119fecce4f647eaa49565b024678cf9 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Tue, 4 Jan 2011 19:52:25 -0700 Subject: Display an item's tags in the info block. --- modules/tag/helpers/tag_event.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'modules') diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index 829089c4..78fe7058 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -147,4 +147,20 @@ class tag_event_Core { } } } + + static function info_block_metadata($block, $item) { + $tags = array(); + foreach (tag::item_tags($item) as $tag) { + $tags[] = "name}") . "\">$tag->name"; + } + if (count($tags)) { + $info = $block->content->metadata; + $info["tags"] = array( + "label" => t("Tags:"), + "value" => implode(", ", $tags) + ); + $block->content->metadata = $info; + } + } + } -- cgit v1.2.3 From a1e3b1ed17177cf7e0ef6b443afdea6a676f65b2 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Wed, 5 Jan 2011 16:00:35 -0700 Subject: Added info module show metadata options and set all to true. Admins may turn off display of items from the Advanced Settings list. --- modules/info/helpers/info_installer.php | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 modules/info/helpers/info_installer.php (limited to 'modules') diff --git a/modules/info/helpers/info_installer.php b/modules/info/helpers/info_installer.php new file mode 100644 index 00000000..51962173 --- /dev/null +++ b/modules/info/helpers/info_installer.php @@ -0,0 +1,41 @@ + Date: Thu, 6 Jan 2011 20:57:56 -0700 Subject: Missed this commiting this in a1e3b1ed17177cf7e0ef. --- modules/info/module.info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/info/module.info b/modules/info/module.info index e352213c..5f84cbb9 100644 --- a/modules/info/module.info +++ b/modules/info/module.info @@ -1,3 +1,3 @@ name = "Info" description = "Display extra information about photos and albums" -version = 1 +version = 2 -- cgit v1.2.3 From a897a9d53f7df79f55888141444a22f38665dce6 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Thu, 6 Jan 2011 21:00:28 -0700 Subject: Also missed commiting this in a1e3b1ed17177cf7e0ef. --- modules/info/helpers/info_block.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'modules') diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php index 064c73b2..5841ec6f 100644 --- a/modules/info/helpers/info_block.php +++ b/modules/info/helpers/info_block.php @@ -31,29 +31,31 @@ class info_block_Core { $block->css_id = "g-metadata"; $block->title = $theme->item()->is_album() ? t("Album info") : t("Photo info"); $block->content = new View("info_block.html"); - $info["title"] = array( - "label" => t("Title:"), - "value" => html::purify($theme->item->title) - ); - if ($theme->item->description) { + if ($theme->item->title && module::get_var("info", "show_title")) { + $info["title"] = array( + "label" => t("Title:"), + "value" => html::purify($theme->item->title) + ); + } + if ($theme->item->description && module::get_var("info", "show_description")) { $info["description"] = array( "label" => t("Description:"), "value" => nl2br(html::purify($theme->item->description)) ); } - if (!$theme->item->is_album()) { + if (!$theme->item->is_album() && module::get_var("info", "show_name")) { $info["file_name"] = array( "label" => t("File name:"), "value" => html::clean($theme->item->name) ); } - if ($theme->item->captured) { + if ($theme->item->captured && module::get_var("info", "show_captured")) { $info["captured"] = array( "label" => t("Captured:"), "value" => gallery::date_time($theme->item->captured) ); } - if ($theme->item->owner) { + if ($theme->item->owner && module::get_var("info", "show_owner")) { $display_name = $theme->item->owner->display_name(); if ($theme->item->owner->url) { $info["owner"] = array( -- cgit v1.2.3 From 06d94065ce0919f34151da05b32642a95397044f Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Thu, 6 Jan 2011 21:03:19 -0700 Subject: Updates per Bharat's pull request review. Renamed info_block_metadata event to info_block_get_metadata. --- modules/info/helpers/info_block.php | 2 +- modules/info/views/info_block.html.php | 4 ++-- modules/tag/helpers/tag_event.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php index 5841ec6f..9596bc41 100644 --- a/modules/info/helpers/info_block.php +++ b/modules/info/helpers/info_block.php @@ -71,7 +71,7 @@ class info_block_Core { } $block->content->metadata = $info; - module::event("info_block_metadata", $block, $theme->item); + module::event("info_block_get_metadata", $block, $theme->item); } break; } diff --git a/modules/info/views/info_block.html.php b/modules/info/views/info_block.html.php index 7c162767..b296fa1d 100644 --- a/modules/info/views/info_block.html.php +++ b/modules/info/views/info_block.html.php @@ -1,8 +1,8 @@ diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index 78fe7058..6b8de723 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -148,12 +148,12 @@ class tag_event_Core { } } - static function info_block_metadata($block, $item) { + static function info_block_get_metadata($block, $item) { $tags = array(); foreach (tag::item_tags($item) as $tag) { - $tags[] = "name}") . "\">$tag->name"; + $tags[] = "name}") . "\">{$tag->name}"; } - if (count($tags)) { + if ($tags) { $info = $block->content->metadata; $info["tags"] = array( "label" => t("Tags:"), -- cgit v1.2.3 From f2477703faa7cd05ff1aa16da3ecef7b666bef40 Mon Sep 17 00:00:00 2001 From: Joe7 Date: Fri, 7 Jan 2011 17:33:37 +0100 Subject: Fix against ticket #1581 - based on https://github.com/Joe7/gallery3/commit/0d36b97aca3b5ed53ea3ea398ce28b0f6198e577 --- modules/g2_import/helpers/g2_import.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'modules') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 8de5ce44..b2e3836a 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -499,6 +499,9 @@ class g2_import_Core { static function set_album_highlight(&$queue) { // Dequeue the current album and enqueue its children list($g2_album_id, $children) = each($queue); + if (empty($children)) { + return; + } unset($queue[$g2_album_id]); foreach ($children as $key => $value) { $queue[$key] = $value; -- cgit v1.2.3 From c338d3138e2c93bfb219a8d32ba9110138fcf9c2 Mon Sep 17 00:00:00 2001 From: Joe7 Date: Thu, 6 Jan 2011 02:31:50 +0100 Subject: Importing Gallery2 users in batches Fixes Ticket #1554 --- modules/g2_import/helpers/g2_import.php | 22 +++++++++++++++++++++- modules/g2_import/helpers/g2_import_task.php | 4 ++-- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index b2e3836a..5e2a61e8 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -1155,7 +1155,7 @@ class g2_import_Core { "SELECT [GalleryComment::id] " . "FROM [GalleryComment] " . "WHERE [GalleryComment::publishStatus] = 0 " . // 0 == COMMENT_PUBLISH_STATUS_PUBLISHED - "AND [GalleryComment::id] > ?", + "AND [GalleryComment::id] > ?", array($min_id), array("limit" => array("count" => 100)))); while ($result = $results->nextResult()) { @@ -1183,6 +1183,26 @@ class g2_import_Core { return $ids; } + /** + * Get a set of user ids from Gallery 2 greater than $min_id. We use this to get the + * next chunk of users to import. + */ + static function get_user_ids($min_id) { + global $gallery; + + $ids = array(); + $results = g2($gallery->search( + "SELECT [GalleryUser::id] " . + "FROM [GalleryUser] " . + "WHERE [GalleryUser::id] > ?", + array($min_id), + array("limit" => array("count" => 100)))); + while ($result = $results->nextResult()) { + $ids[] = $result[0]; + } + return $ids; + } + /** * Look in our map to find the corresponding Gallery 3 id for the given Gallery 2 id. */ diff --git a/modules/g2_import/helpers/g2_import_task.php b/modules/g2_import/helpers/g2_import_task.php index f2a13291..dbfe5f77 100644 --- a/modules/g2_import/helpers/g2_import_task.php +++ b/modules/g2_import/helpers/g2_import_task.php @@ -109,8 +109,8 @@ class g2_import_task_Core { case "users": if (empty($queue)) { - $task->set( - "queue", $queue = array_keys(g2(GalleryCoreApi::fetchUsersForGroup(GROUP_EVERYBODY)))); + $task->set("queue", $queue = g2_import::get_user_ids($task->get("last_id", 0))); + $task->set("last_id", end($queue)); } $log_message = g2_import::import_user($queue); if ($log_message) { -- cgit v1.2.3 From 5bfb7fb96a5dc2e0bc511c998a7c055b83b2915a Mon Sep 17 00:00:00 2001 From: Joe7 Date: Thu, 6 Jan 2011 04:49:50 +0100 Subject: Added batch importer for groups Added missing ordering for comments and tags retrieving queries (One might gets the same output without ordering especially if column is the primary key, but the only way to go for sure it by setting it) --- modules/g2_import/helpers/g2_import.php | 30 +++++++++++++++++++++++++--- modules/g2_import/helpers/g2_import_task.php | 4 ++-- 2 files changed, 29 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 5e2a61e8..c3d774ea 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -1155,7 +1155,8 @@ class g2_import_Core { "SELECT [GalleryComment::id] " . "FROM [GalleryComment] " . "WHERE [GalleryComment::publishStatus] = 0 " . // 0 == COMMENT_PUBLISH_STATUS_PUBLISHED - "AND [GalleryComment::id] > ?", + "AND [GalleryComment::id] > ?" . + "ORDER BY [GalleryComment::id] ASC", array($min_id), array("limit" => array("count" => 100)))); while ($result = $results->nextResult()) { @@ -1174,7 +1175,8 @@ class g2_import_Core { $ids = array(); $results = g2($gallery->search( "SELECT DISTINCT([TagItemMap::itemId]) FROM [TagItemMap] " . - "WHERE [TagItemMap::itemId] > ?", + "WHERE [TagItemMap::itemId] > ?" . + "ORDER BY [TagItemMap::itemId] ASC", array($min_id), array("limit" => array("count" => 100)))); while ($result = $results->nextResult()) { @@ -1194,7 +1196,29 @@ class g2_import_Core { $results = g2($gallery->search( "SELECT [GalleryUser::id] " . "FROM [GalleryUser] " . - "WHERE [GalleryUser::id] > ?", + "WHERE [GalleryUser::id] > ?" . + "ORDER BY [GalleryUser::id] ASC", + array($min_id), + array("limit" => array("count" => 100)))); + while ($result = $results->nextResult()) { + $ids[] = $result[0]; + } + return $ids; + } + + /** + * Get a set of group ids from Gallery 2 greater than $min_id. We use this to get the + * next chunk of groups to import. + */ + static function get_group_ids($min_id) { + global $gallery; + + $ids = array(); + $results = g2($gallery->search( + "SELECT [GalleryGroup::id] " . + "FROM [GalleryGroup] " . + "WHERE [GalleryGroup::id] > ?" . + "ORDER BY [GalleryGroup::id] ASC", array($min_id), array("limit" => array("count" => 100)))); while ($result = $results->nextResult()) { diff --git a/modules/g2_import/helpers/g2_import_task.php b/modules/g2_import/helpers/g2_import_task.php index dbfe5f77..a90b1fc3 100644 --- a/modules/g2_import/helpers/g2_import_task.php +++ b/modules/g2_import/helpers/g2_import_task.php @@ -96,7 +96,8 @@ class g2_import_task_Core { switch($modes[$mode]) { case "groups": if (empty($queue)) { - $task->set("queue", $queue = array_keys(g2(GalleryCoreApi::fetchGroupNames()))); + $task->set("queue", $queue = g2_import::get_group_ids($task->get("last_id", 0))); + $task->set("last_id", end($queue)); } $log_message = g2_import::import_group($queue); if ($log_message) { @@ -141,7 +142,6 @@ class g2_import_task_Core { $task->set("queue", $queue = g2_import::get_item_ids($task->get("last_id", 0))); $task->set("last_id", end($queue)); } - $log_message = g2_import::import_item($queue); if ($log_message) { $task->log($log_message); -- cgit v1.2.3 From e86e8b8bd1d828d81080c63f9a063254145115e4 Mon Sep 17 00:00:00 2001 From: Joe7 Date: Fri, 7 Jan 2011 17:53:37 +0100 Subject: Added missing spaces (manual merging from 0d36b97aca3b5ed53ea3ea398ce28b0f6198e577) --- modules/g2_import/helpers/g2_import.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index c3d774ea..162aa67b 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -1155,7 +1155,7 @@ class g2_import_Core { "SELECT [GalleryComment::id] " . "FROM [GalleryComment] " . "WHERE [GalleryComment::publishStatus] = 0 " . // 0 == COMMENT_PUBLISH_STATUS_PUBLISHED - "AND [GalleryComment::id] > ?" . + "AND [GalleryComment::id] > ? " . "ORDER BY [GalleryComment::id] ASC", array($min_id), array("limit" => array("count" => 100)))); @@ -1175,7 +1175,7 @@ class g2_import_Core { $ids = array(); $results = g2($gallery->search( "SELECT DISTINCT([TagItemMap::itemId]) FROM [TagItemMap] " . - "WHERE [TagItemMap::itemId] > ?" . + "WHERE [TagItemMap::itemId] > ? " . "ORDER BY [TagItemMap::itemId] ASC", array($min_id), array("limit" => array("count" => 100)))); @@ -1196,7 +1196,7 @@ class g2_import_Core { $results = g2($gallery->search( "SELECT [GalleryUser::id] " . "FROM [GalleryUser] " . - "WHERE [GalleryUser::id] > ?" . + "WHERE [GalleryUser::id] > ? " . "ORDER BY [GalleryUser::id] ASC", array($min_id), array("limit" => array("count" => 100)))); @@ -1217,7 +1217,7 @@ class g2_import_Core { $results = g2($gallery->search( "SELECT [GalleryGroup::id] " . "FROM [GalleryGroup] " . - "WHERE [GalleryGroup::id] > ?" . + "WHERE [GalleryGroup::id] > ? " . "ORDER BY [GalleryGroup::id] ASC", array($min_id), array("limit" => array("count" => 100)))); -- cgit v1.2.3 From 4756db435c1b934137f0ca2f169f74ab509ab72f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 7 Jan 2011 20:09:27 -0800 Subject: Minor style cleanup --- modules/info/helpers/info_block.php | 3 ++- modules/tag/helpers/tag_event.php | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php index 9596bc41..74c92510 100644 --- a/modules/info/helpers/info_block.php +++ b/modules/info/helpers/info_block.php @@ -60,7 +60,8 @@ class info_block_Core { if ($theme->item->owner->url) { $info["owner"] = array( "label" => t("Owner:"), - "value" => "item->owner->url}\">" . html::clean($display_name) . "" + "value" => "item->owner->url}\">" . + html::clean($display_name) . "" ); } else { $info["owner"] = array( diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index 6b8de723..baf8b1ae 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -156,11 +156,10 @@ class tag_event_Core { if ($tags) { $info = $block->content->metadata; $info["tags"] = array( - "label" => t("Tags:"), - "value" => implode(", ", $tags) + "label" => t("Tags:"), + "value" => implode(", ", $tags) ); $block->content->metadata = $info; } } - } -- cgit v1.2.3 From 85ae3202886d2bd132f6cd327cc2d9f0650ca911 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 5 Jan 2011 21:05:20 -0800 Subject: Keep Item_Model::scale_dimensions from upscaling. Fixes #1579. --- modules/gallery/models/item.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 7ddcb4c2..88a444b4 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -653,7 +653,7 @@ class Item_Model_Core extends ORM_MPTT { /** * Calculate the largest width/height that fits inside the given maximum, while preserving the - * aspect ratio. + * aspect ratio. Don't upscale. * @param int $max Maximum size of the largest dimension * @return array */ @@ -661,6 +661,10 @@ class Item_Model_Core extends ORM_MPTT { $width = $this->thumb_width; $height = $this->thumb_height; + if ($width <= $max && $height <= $max) { + return array($height, $width); + } + if ($height) { if (isset($max)) { if ($width > $height) { -- cgit v1.2.3 From edcb3b665690acc85067bc43e1900390be228a4e Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 7 Jan 2011 20:23:49 -0800 Subject: Make the CSS for the organize menu consistently g-organize-link. Fixes #1070. --- modules/organize/helpers/organize_event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/organize/helpers/organize_event.php b/modules/organize/helpers/organize_event.php index 2f997600..d6d21fc1 100644 --- a/modules/organize/helpers/organize_event.php +++ b/modules/organize/helpers/organize_event.php @@ -26,7 +26,7 @@ class organize_event_Core { ->append(Menu::factory("dialog") ->id("organize") ->label(t("Organize album")) - ->css_id("g-menu-organize-link") + ->css_id("g-organize-link") ->url(url::site("organize/dialog/{$item->id}"))); } } -- cgit v1.2.3