Less parsing of photos/albums on client-side
This commit is contained in:
parent
a244f2ed51
commit
911e168b6f
@ -88,8 +88,7 @@ album = {
|
|||||||
|
|
||||||
parse: function(photo) {
|
parse: function(photo) {
|
||||||
|
|
||||||
if (photo&&photo.thumbUrl) photo.thumbUrl = lychee.upload_path_thumb + photo.thumbUrl;
|
if (!album.json.title) album.json.title = "Untitled";
|
||||||
else if (!album.json.title) album.json.title = "Untitled";
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -88,9 +88,9 @@ albums = {
|
|||||||
album.thumb1 = "assets/img/password.svg";
|
album.thumb1 = "assets/img/password.svg";
|
||||||
album.thumb2 = "assets/img/password.svg";
|
album.thumb2 = "assets/img/password.svg";
|
||||||
} else {
|
} else {
|
||||||
if (album.thumb0) album.thumb0 = lychee.upload_path_thumb + album.thumb0; else album.thumb0 = "assets/img/no_images.svg";
|
if (!album.thumb0) album.thumb0 = "assets/img/no_images.svg";
|
||||||
if (album.thumb1) album.thumb1 = lychee.upload_path_thumb + album.thumb1; else album.thumb1 = "assets/img/no_images.svg";
|
if (!album.thumb1) album.thumb1 = "assets/img/no_images.svg";
|
||||||
if (album.thumb2) album.thumb2 = lychee.upload_path_thumb + album.thumb2; else album.thumb2 = "assets/img/no_images.svg";
|
if (!album.thumb2) album.thumb2 = "assets/img/no_images.svg";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,6 @@ var lychee = {
|
|||||||
updateURL: "https://github.com/electerious/Lychee",
|
updateURL: "https://github.com/electerious/Lychee",
|
||||||
website: "http://lychee.electerious.com",
|
website: "http://lychee.electerious.com",
|
||||||
|
|
||||||
upload_path_thumb: "uploads/thumb/",
|
|
||||||
upload_path_big: "uploads/big/",
|
|
||||||
|
|
||||||
publicMode: false,
|
publicMode: false,
|
||||||
viewMode: false,
|
viewMode: false,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
@ -52,7 +52,6 @@ photo = {
|
|||||||
parse: function() {
|
parse: function() {
|
||||||
|
|
||||||
if (!photo.json.title) photo.json.title = "Untitled";
|
if (!photo.json.title) photo.json.title = "Untitled";
|
||||||
photo.json.url = lychee.upload_path_big + photo.json.url;
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -246,7 +246,6 @@ view = {
|
|||||||
var photosData = "";
|
var photosData = "";
|
||||||
|
|
||||||
$.each(album.json.content, function() {
|
$.each(album.json.content, function() {
|
||||||
album.parse(this);
|
|
||||||
photosData += build.photo(this);
|
photosData += build.photo(this);
|
||||||
});
|
});
|
||||||
lychee.content.html(photosData);
|
lychee.content.html(photosData);
|
||||||
|
File diff suppressed because one or more lines are too long
@ -21,4 +21,8 @@ define('LYCHEE_PLUGINS', LYCHEE . 'plugins/');
|
|||||||
# Define files
|
# Define files
|
||||||
define('LYCHEE_CONFIG_FILE', LYCHEE_DATA . 'config.php');
|
define('LYCHEE_CONFIG_FILE', LYCHEE_DATA . 'config.php');
|
||||||
|
|
||||||
|
# Define urls
|
||||||
|
define('LYCHEE_URL_UPLOADS_THUMB', 'uploads/thumb/');
|
||||||
|
define('LYCHEE_URL_UPLOADS_BIG', 'uploads/big/');
|
||||||
|
|
||||||
?>
|
?>
|
@ -97,6 +97,7 @@ class Album extends Module {
|
|||||||
$photo['sysdate'] = date('d F Y', substr($photo['id'], 0, -4));
|
$photo['sysdate'] = date('d F Y', substr($photo['id'], 0, -4));
|
||||||
$photo['previousPhoto'] = $previousPhotoID;
|
$photo['previousPhoto'] = $previousPhotoID;
|
||||||
$photo['nextPhoto'] = '';
|
$photo['nextPhoto'] = '';
|
||||||
|
$photo['thumbUrl'] = LYCHEE_URL_UPLOADS_THUMB . $photo['thumbUrl'];
|
||||||
|
|
||||||
if ($photo['takestamp']!=='0') {
|
if ($photo['takestamp']!=='0') {
|
||||||
$photo['cameraDate'] = 1;
|
$photo['cameraDate'] = 1;
|
||||||
@ -175,7 +176,7 @@ class Album extends Module {
|
|||||||
# For each thumb
|
# For each thumb
|
||||||
$k = 0;
|
$k = 0;
|
||||||
while ($thumb = $thumbs->fetch_object()) {
|
while ($thumb = $thumbs->fetch_object()) {
|
||||||
$album["thumb$k"] = $thumb->thumbUrl;
|
$album["thumb$k"] = LYCHEE_URL_UPLOADS_THUMB . $thumb->thumbUrl;
|
||||||
$k++;
|
$k++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +207,7 @@ class Album extends Module {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
while($row = $unsorted->fetch_object()) {
|
while($row = $unsorted->fetch_object()) {
|
||||||
if ($i<3) {
|
if ($i<3) {
|
||||||
$return["unsortedThumb$i"] = $row->thumbUrl;
|
$return["unsortedThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row->thumbUrl;
|
||||||
$i++;
|
$i++;
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
@ -217,7 +218,7 @@ class Album extends Module {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
while($row2 = $public->fetch_object()) {
|
while($row2 = $public->fetch_object()) {
|
||||||
if ($i<3) {
|
if ($i<3) {
|
||||||
$return["publicThumb$i"] = $row2->thumbUrl;
|
$return["publicThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row2->thumbUrl;
|
||||||
$i++;
|
$i++;
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
@ -228,7 +229,7 @@ class Album extends Module {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
while($row3 = $starred->fetch_object()) {
|
while($row3 = $starred->fetch_object()) {
|
||||||
if ($i<3) {
|
if ($i<3) {
|
||||||
$return["starredThumb$i"] = $row3->thumbUrl;
|
$return["starredThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl;
|
||||||
$i++;
|
$i++;
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
@ -239,7 +240,7 @@ class Album extends Module {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
while($row3 = $recent->fetch_object()) {
|
while($row3 = $recent->fetch_object()) {
|
||||||
if ($i<3) {
|
if ($i<3) {
|
||||||
$return["recentThumb$i"] = $row3->thumbUrl;
|
$return["recentThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl;
|
||||||
$i++;
|
$i++;
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
|
@ -390,6 +390,9 @@ class Photo extends Module {
|
|||||||
$photo['sysdate'] = date('d M. Y', substr($photo['id'], 0, -4));
|
$photo['sysdate'] = date('d M. Y', substr($photo['id'], 0, -4));
|
||||||
if (strlen($photo['takestamp'])>1) $photo['takedate'] = date('d M. Y', $photo['takestamp']);
|
if (strlen($photo['takestamp'])>1) $photo['takedate'] = date('d M. Y', $photo['takestamp']);
|
||||||
|
|
||||||
|
# Parse url
|
||||||
|
$photo['url'] = LYCHEE_URL_UPLOADS_BIG . $photo['url'];
|
||||||
|
|
||||||
if ($albumID!='false') {
|
if ($albumID!='false') {
|
||||||
|
|
||||||
if ($photo['album']!=0) {
|
if ($photo['album']!=0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user