Better cache. Better gc.
This commit is contained in:
parent
319ac51d60
commit
9220ea44b5
@ -146,6 +146,7 @@ class Photo(object):
|
||||
right = image.size[0]
|
||||
bottom = image.size[1] - ((image.size[1] - image.size[0]) / 2)
|
||||
image = image.crop((left, top, right, bottom))
|
||||
gc.collect()
|
||||
image.thumbnail((size, size), Image.ANTIALIAS)
|
||||
try:
|
||||
image.save(thumb_path, "JPEG")
|
||||
|
@ -11,19 +11,25 @@ $(document).ready(function() {
|
||||
return "cache/" + cachePath(path + "/" + image + "_" + suffix + ".jpg");
|
||||
}
|
||||
function loadAlbum(path) {
|
||||
if (path in album_cache) {
|
||||
albumLoaded(album_cache[path]);
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "cache/" + path + ".json",
|
||||
error: function() { $(document.body).html("Couldn't fetch it."); },
|
||||
success: function(album) {
|
||||
success: albumLoaded
|
||||
});
|
||||
}
|
||||
function albumLoaded(album) {
|
||||
album_cache[cachePath(album.path)] = album;
|
||||
current_album = album;
|
||||
if (current_image_cache != null)
|
||||
showPhoto();
|
||||
else
|
||||
else if (cachePath(album.path) == current_album_cache)
|
||||
showAlbum();
|
||||
}
|
||||
});
|
||||
}
|
||||
function showAlbum() {
|
||||
$("html, body").animate({ scrollTop: 0 }, "slow");
|
||||
var title = "";
|
||||
@ -73,6 +79,7 @@ $(document).ready(function() {
|
||||
var current_album_cache = "";
|
||||
var current_image_cache = "";
|
||||
var current_album = null;
|
||||
var album_cache = new Array();
|
||||
$(window).hashchange(function() {
|
||||
var new_album_cache = location.hash.substring(1);
|
||||
var index = new_album_cache.lastIndexOf("/");
|
||||
|
Loading…
Reference in New Issue
Block a user