#!/usr/bin/env python # Por Alexandre Garcia (c) 2006 # Wed, 06 Dec 2006 import os, time, string, Image, glob THUMBSIZE = 230, 153 PATH = "/home/amg/Fotos/Minhas/" # Alterar para o directorio das fotos HTML = PATH + "index.html" TITLE = "Fotos" # Alterar para o titulo do site ficheiro = open(HTML,"w") def converter(): os.chdir(PATH) for imagem in glob.glob("*.JPG"): img = Image.open(imagem) img.thumbnail(THUMBSIZE) if imagem[0:5] != "thumb": img.save('thumb.' + str(imagem), "JPEG") def gerar(): os.chdir(PATH) imgthumb = glob.glob("thumb.*") ficheiro.write("" + TITLE + "
" + TITLE + "

") for thumb in imgthumb: thumb = '' + '' + '' + '' + ' ' ficheiro.write(thumb) ficheiro.write("

Actualizado em " + time.strftime("%d-%m-%Y %H:%M:%S") + "
Galeria - Script feito por Alexandre Garcia (c) 2006
") ficheiro.close() converter() gerar()