gzuncompress
|
Server IP : 172.19.0.3 / Your IP : 216.73.216.178 Web Server : Apache/2.4 System : Linux 880f91b28fd7 5.15.0-117-generic #127~20.04.1-Ubuntu SMP Thu Jul 11 15:36:12 UTC 2024 x86_64 User : tomlinde ( 155017) PHP Version : 5.6.40 Disable Function : dl, syslog, opcache_get_status MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/webpages/lima-city/tomlinde/html/gallpam/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] | [ Lock Shell ] | [ Logout ] |
|---|
function fitPic(){
var pic = document.getElementById('pic');
origW = pic.width;
origH = pic.height;
if(origW == 0 || origH == 0)
return;
ratio = origW/origH;
newW = window.innerWidth - 20;
newWH = newW*(1/ratio);
newH = window.innerHeight - 20;
if(newH > newWH){
pic.style.width = newW + "px";
pic.style.height = newWH + "px";
} else {
pic.style.width = (newH*ratio) + "px";
pic.style.height = newH + "px";
}
pic.style.display = "inline";
}
function nextPic(){
var pic = document.getElementById('pic');
pic.style.width = "auto";
pic.style.height = "auto";
pic.id = "pic" + currentPic;
pic.style.display = "none";
document.getElementById("container").removeChild(pic);
if((myPics.length - 1) > currentPic){
currentPic = currentPic + 1;
} else {
currentPic = 0;
}
if(document.getElementById("pic" + currentPic) != null){
//test("using cache")
} else {
var img = new Image();
var size = findCacheSizeId()
if(size == -1)
img.src = "pictures/" + activeFolder + "/" + myPics[currentPic];
else
img.src = "cachedImage.php?path=" + activeFolder + "/&name=" + myPics[currentPic] + "&size=" + cacheSizes[size];
img.id = "pic" + currentPic;
document.getElementById("container").appendChild(img);
}
document.getElementById("pic" + currentPic).id = "pic"
fitPic();
var newPic = document.getElementById('pic');
newPic.setAttribute("onclick", "nextPic()");
newPic.setAttribute("onload", "fitPic()");
newPic.style.display = "inline";
updateCache(currentPic, 6);
}
function findCacheSizeId(){
var index = -1;
for(var i=0; i<cacheSizes.length; i++){
var x = cacheSizes[i].split("x",2)[0];
var y = cacheSizes[i].split("x",2)[1];
if(window.innerWidth < x || window.innerHeight < y){
index = i;
break;
}
}
return index;
}
function fitCaller(){
var pic = document.getElementById('pic');
if(pic.complete)
fitPic();
else
setTimeout("fitCaller();", 50);
}
function updateCache(base, range, accu){
if(typeof accu == "undefined" ){
accu = 0;
}
//if the image is allready cache dont add it again and go forward to next one
if(document.getElementById("pic" + (base + accu)) != null){
if(document.getElementById("pic" + (base + accu)).complete){
if(range > 0 && currentPic == base){
updateCache(base, (range - 1), (accu + 1))
} else if(0 > range && currentPic == base){
updateCache(base, (range + 1), (accu + 1))
}
}
return;
}
var img = new Image();
img.style.display="none";
var size = findCacheSizeId()
if(size == -1)
img.src = "pictures/" + activeFolder + "/" + myPics[base + accu];
else
img.src = "cachedImage.php?path=" + activeFolder + "/&name=" + myPics[base + accu] + "&size=" + cacheSizes[size];
img.id = "pic" + (base + accu);
if(range > 0 && currentPic == base){
img.setAttribute("onload", "updateCache(" + base + ", " + (range - 1) + ", " + (accu + 1) + ");");
} else if(0 > range && currentPic == base){
img.setAttribute("onload", "updateCache(" + base + ", " + (range + 1) + ", " + (accu + 1) + ");");
}
document.getElementById("container").appendChild(img);
}
function test(str){
var command = "alert('" + str + "');";
setTimeout(command, 0);
}