including HTML as images. creates an IFRAME for them..
This commit is contained in:
21
Qalbum.py
21
Qalbum.py
@@ -31,6 +31,7 @@ __version__='1.10'
|
||||
webfilesearch=re.compile('.*index.html$|gallerystyle.css$|galleryscript.js$|descriptions.csv$|^info.txt$|\..*',re.I)
|
||||
imagesearch=re.compile('.*\.jpg$|.*\.jpeg$|.*\.gif$|.*\.png$|.*\.svg$|.*\.pdf$',re.I)
|
||||
vectorsearch=re.compile('.*\.svg$|.*\.pdf$',re.I)
|
||||
nonconvertiblesearch=re.compile('.*\.html$|.*\.htm$|.*\.php$',re.I)
|
||||
#gifsearch=re.compile('.*gif$',re.I)
|
||||
excludepaths=re.compile('_med|_tn|\..*')
|
||||
doublequotes=re.compile('"')
|
||||
@@ -74,6 +75,22 @@ def getimagelist(path,options=False):
|
||||
imgs.sort()
|
||||
return imgs
|
||||
|
||||
def getnonconvertiblelist(path,options=False):
|
||||
''' Returns a list of files matching the nonconvertible regex '''
|
||||
list=os.listdir(path)
|
||||
files=[]
|
||||
for f in list:
|
||||
if (nonconvertiblesearch.match(f)) and (os.path.isfile(os.path.join(path,f))) and not (webfilesearch.match(f)):
|
||||
files.append(f)
|
||||
if options:
|
||||
if options.timesort:
|
||||
files.sort(key=lambda f: os.path.getmtime(os.path.join(path, f)),reverse=options.reverse)
|
||||
else:
|
||||
files.sort(reverse=options.reverse)
|
||||
else:
|
||||
files.sort()
|
||||
return files
|
||||
|
||||
def getfiletimes(path,list):
|
||||
''' Returns a list of modification times '''
|
||||
times=[]
|
||||
@@ -343,6 +360,8 @@ def traverse(path,crumbs,inputs,options):
|
||||
print('Depth: '+str(len(crumbs)))
|
||||
pathlist=getpathlist(path,options)
|
||||
imagelist=getimagelist(path,options)
|
||||
createthumbs(path,imagelist,options)
|
||||
imagelist.extend(getnonconvertiblelist(path,options))
|
||||
filelist=getnonimagelist(path,options)
|
||||
print(str(len(pathlist))+' paths')
|
||||
print(str(len(imagelist))+' images')
|
||||
@@ -378,7 +397,7 @@ def traverse(path,crumbs,inputs,options):
|
||||
f.write('<div id="listcontainer"></div>')
|
||||
f.write(getfooter())
|
||||
f.close()
|
||||
createthumbs(path,imagelist,options)
|
||||
|
||||
for p in pathlist:
|
||||
nextcrumbs=[i for i in crumbs]
|
||||
nextcrumbs.append(os.path.join(path,p))
|
||||
|
||||
@@ -984,14 +984,22 @@ function showbigimage(i) {
|
||||
if (fullscreen) { height=height+200; }
|
||||
if (originals) { mediumstr=encodeURIComponent(imagelist[i]); }
|
||||
else { mediumstr='_med/med_'+encodeURIComponent(imagelist[i])+'.jpg'; }
|
||||
if (isHTML(imagelist[i])) {
|
||||
$('#imagecontainer').html('<div id="imagebig"><a class="linktobig" href="'+encodeURIComponent(imagelist[i])+'" target="_blank">'+
|
||||
'<iframe id="imagesingle" src="'+encodeURIComponent(imagelist[i])+'"></a></div>');
|
||||
$('#imagesingle').css('width',width);
|
||||
$('#imagesingle').css('height',height);
|
||||
} else { // is image
|
||||
$('#imagecontainer').html('<div id="imagebig"><a class="linktobig" href="'+encodeURIComponent(imagelist[i])+'" target="_blank">'+
|
||||
'<img id="imagesingle" src="'+mediumstr+'"></a></div>');
|
||||
$('#imagesingle').css('max-width',width);
|
||||
$('#imagecontainer').css('height',height);
|
||||
$('#imagesingle').css('max-height',height);
|
||||
}
|
||||
$('#imagecontainer').css('height',height);
|
||||
|
||||
$('#desccontainer').html(getProgressEl()+currentlink(i)+imagedesc[i]);
|
||||
$('#desccontainer').css('display','block');
|
||||
if (zoom) {
|
||||
if (zoom & !isHTML(imagelist[i])) {
|
||||
$(document).ready(function() {
|
||||
|
||||
var options = {
|
||||
@@ -1450,6 +1458,10 @@ function getmaxthumbs() {
|
||||
return Math.floor((document.body.clientWidth-30)/100)-2;
|
||||
}
|
||||
|
||||
function isHTML(s) {
|
||||
return s.match(/html$/i);
|
||||
}
|
||||
|
||||
function hidethumbs() {
|
||||
// hide all thumbnails (obsolete)
|
||||
if (notsupported()) {
|
||||
|
||||
Reference in New Issue
Block a user