summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/graphics.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2013-01-31 15:48:18 -0800
committerBharat Mediratta <bharat@menalto.com>2013-01-31 15:48:18 -0800
commitcb08f6cc13bfd07aed2e6588cad6a6cc655b73f6 (patch)
tree6c99c587e0fb6ee029773ea5690f9e92d28d4e9a /modules/gallery/helpers/graphics.php
parent795f2569941f582127885f0bdcabe089d644a5d6 (diff)
parentf83ed5f8716663a45c9d8e8118bbcf0e2849c3fb (diff)
Merge pull request #115 from shadlaws/fix_1982
#1982 - Add placeholder for albums with no album cover.
Diffstat (limited to 'modules/gallery/helpers/graphics.php')
-rw-r--r--modules/gallery/helpers/graphics.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 19ae1036..7c8e89d5 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -152,6 +152,7 @@ class graphics_Core {
} catch (Exception $e) {
// Didn't work, likely because of MISSING_FFMPEG - use placeholder
graphics::_replace_image_with_placeholder($item, $target);
+ break;
}
}
$working_file = $output_file;
@@ -167,7 +168,7 @@ class graphics_Core {
case "album":
if (!$cover = $item->album_cover()) {
- // This album has no cover; there's nothing to generate. Because of an old bug, it's
+ // This album has no cover; copy its placeholder image. Because of an old bug, it's
// possible that there's an album cover item id that points to an invalid item. In that
// case, just null out the album cover item id. It's not optimal to do that at this low
// level, but it's not trivial to find these cases quickly in an upgrade script and if we
@@ -179,7 +180,8 @@ class graphics_Core {
$item->album_cover_item_id = null;
$item->save();
}
- return;
+ graphics::_replace_image_with_placeholder($item, $target);
+ break;
}
if ($cover->thumb_dirty) {
graphics::generate($cover);
@@ -238,7 +240,9 @@ class graphics_Core {
}
private static function _replace_image_with_placeholder($item, $target) {
- if ($item->is_movie() || ($item->is_album() && $item->album_cover()->is_movie())) {
+ if ($item->is_album() && !$item->album_cover_item_id) {
+ $input_path = MODPATH . "gallery/images/missing_album_cover.jpg";
+ } else if ($item->is_movie() || ($item->is_album() && $item->album_cover()->is_movie())) {
$input_path = MODPATH . "gallery/images/missing_movie.jpg";
} else {
$input_path = MODPATH . "gallery/images/missing_photo.jpg";