Ejemplo n.º 1
0
def del_checker():
    logToFile(logFile, 'del_checker\tdel_checker 0.1a started..')
    thumb_list = getit(THUMBpictureDir)
    for thumb in thumb_list:
        if not os.access(pictureDir+'/'+thumb, os.F_OK):
            logToFile(logFile, 'del_checker:\tDEL FILE '+THUMBpictureDir+'/'+thumb+' !')
            os.remove(THUMBpictureDir+'/'+thumb)
Ejemplo n.º 2
0
def mainpage():
    logToFile(logFile, 'bottle:\t\tClient connecting from '+str(request['REMOTE_ADDR']))

    content = 'lorem ipsum blablablablabla'

    thumber()
    del_checker()
    img_scaler()

    thumbs = getit(THUMBpictureDir)    
    return template('child', mytitle=web_title, myheader=web_header, mycontent=content, myfooter=web_footer, thumbDir=THUMBpictureDir, picDir=pictureDir, thumbs=thumbs)
Ejemplo n.º 3
0
def img_scaler():
    logToFile(logFile, 'image_scaler\timage_scaler 0.1a started')
    imgList = getit(pictureDir)
    for img in imgList:
        pic = Image.open(pictureDir+'/'+img)
        width, height = pic.size
        if width > PICsize[0] or height > PICsize[1]:
            logToFile(logFile, '\nimage_scaler\twidth, height: '+str(width)+' '+str(height))
            logToFile(logFile, 'image_scaler\tSCALING IMAGE: '+pictureDir+'/'+img)
            pic.thumbnail(PICsize, Image.ANTIALIAS)
            pic.save(pictureDir+'/'+img)
Ejemplo n.º 4
0
def thumber():
    if not os.access(THUMBpictureDir, os.F_OK):
        logToFile(logFile, 'thumber:\t\tERROR (thumber): Der Pfad '+THUMBpictureDir+' existiert nicht!')
        return
    if not os.access(THUMBpictureDir, os.X_OK):
        logToFile(logFile, 'thumber:\t\tERROR (thumber): Auf den Pfad '+THUMBpictureDir+' kann nich zugegriffen werden!')
        return
    if not os.access(THUMBpictureDir, os.R_OK):
        logToFile(logFile, 'thumber:\t\tERROR (thumber): Vom Pfad '+THUMBpictureDir+' kann nicht gelesen werden!')
        return
	
	logToFile(logFile, 'thumber:\t\tthumber 0.1a started...')
    ori_piclist = getit(pictureDir)
    for pic in ori_piclist:
        if not os.access(THUMBpictureDir+'/'+pic, os.F_OK):
            logToFile(logFile, 'thumber:\t\tCREATING THUMB for '+pic)
            im = Image.open(pictureDir+'/'+pic)
            im.thumbnail(THUMBsize, Image.ANTIALIAS)
            im.save(THUMBpictureDir+'/'+pic)