diff --git a/php/Modules/Album.php b/php/Modules/Album.php index 1c03ba5..758554d 100644 --- a/php/Modules/Album.php +++ b/php/Modules/Album.php @@ -99,22 +99,22 @@ final class Album { case 'f': $return['public'] = '0'; - $query = Database::prepare(Database::get(), "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE star = 1 " . Settings::get()['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS)); + $query = Database::prepare(Database::get(), "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url, medium FROM ? WHERE star = 1 " . Settings::get()['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS)); break; case 's': $return['public'] = '0'; - $query = Database::prepare(Database::get(), "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE public = 1 " . Settings::get()['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS)); + $query = Database::prepare(Database::get(), "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url, medium FROM ? WHERE public = 1 " . Settings::get()['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS)); break; case 'r': $return['public'] = '0'; - $query = Database::prepare(Database::get(), "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) " . Settings::get()['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS)); + $query = Database::prepare(Database::get(), "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url, medium FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) " . Settings::get()['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS)); break; case '0': $return['public'] = '0'; - $query = Database::prepare(Database::get(), "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = 0 " . Settings::get()['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS)); + $query = Database::prepare(Database::get(), "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url, medium FROM ? WHERE album = 0 " . Settings::get()['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS)); break; default: @@ -122,7 +122,7 @@ final class Album { $albums = Database::execute(Database::get(), $query, __METHOD__, __LINE__); $return = $albums->fetch_assoc(); $return = Album::prepareData($return); - $query = Database::prepare(Database::get(), "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = '?' " . Settings::get()['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS, $this->albumIDs)); + $query = Database::prepare(Database::get(), "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url, medium FROM ? WHERE album = '?' " . Settings::get()['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS, $this->albumIDs)); break; } diff --git a/php/Modules/Photo.php b/php/Modules/Photo.php index 0da0fbb..59fe4d0 100755 --- a/php/Modules/Photo.php +++ b/php/Modules/Photo.php @@ -634,7 +634,7 @@ final class Photo { public static function prepareData(array $data) { // Excepts the following: - // (array) $data = ['id', 'title', 'tags', 'public', 'star', 'album', 'thumbUrl', 'takestamp', 'url'] + // (array) $data = ['id', 'title', 'tags', 'public', 'star', 'album', 'thumbUrl', 'takestamp', 'url', 'medium'] // Init $photo = null; @@ -647,7 +647,11 @@ final class Photo { $photo['star'] = $data['star']; $photo['album'] = $data['album']; - // Parse urls + // Parse medium + if ($data['medium']==='1') $photo['medium'] = LYCHEE_URL_UPLOADS_MEDIUM . $data['url']; + else $photo['medium'] = ''; + + // Parse paths $photo['thumbUrl'] = LYCHEE_URL_UPLOADS_THUMB . $data['thumbUrl']; $photo['url'] = LYCHEE_URL_UPLOADS_BIG . $data['url']; diff --git a/src/scripts/photo.js b/src/scripts/photo.js index 2552e7a..860ad68 100644 --- a/src/scripts/photo.js +++ b/src/scripts/photo.js @@ -82,10 +82,12 @@ photo.preloadNext = function(photoID) { album.json.content[photoID].nextPhoto!='') { let nextPhoto = album.json.content[photoID].nextPhoto - let url = album.json.content[nextPhoto].url + let medium = album.json.content[nextPhoto].medium - $('head [data-prefetch]').remove() - $('head').append(``) + if (medium!=null && medium!=='') { + $('head [data-prefetch]').remove() + $('head').append(``) + } }