#! /usr/bin/env python # import os,sys,re #-- Get input arguments (no checks though) L_Input_Arguments = sys.argv[1:] Picture_Dir = L_Input_Arguments[0] os.chdir( Picture_Dir ) print "\n 1] Creating web-page for pictrues in %s\n" % (Picture_Dir) #-- Get list of pictures L_InputFiles = [] L_InputFiles_tmp = os.listdir( os.getcwd() ) for filename in L_InputFiles_tmp: if( re.search(r'JPG',filename) ): L_InputFiles.append(filename) if( re.search(r'jpg',filename) ): L_InputFiles.append(filename) #-- Converting pictures to small thumbnails print " 2] Converting pictures to small thumbnails\n" for filename in L_InputFiles: thumbnail_name = 'ThumbNail_' + filename convert_command = 'convert -size 160x120 ' + filename + ' ' + thumbnail_name print " %s" % (convert_command) os.system( convert_command ) #-- Create web-page print "\n 3] Creating Web-page" base_filename = " OT PictureDatabase: " + Picture_Dir webpage_filename = "index.html" webpage_fh = open( webpage_filename , 'w') webpage_fh.write("\n") webpage_fh.write(" " + base_filename + " \n") webpage_fh.write("\n") webpage_fh.write("\n") webpage_fh.write("\n") for filename in L_InputFiles: thumbnail_name = "ThumbNail_" + filename line_a = " \n" # line_b = " " # line_c = " \n" line = line_a + line_b + line_c webpage_fh.write(line) webpage_fh.write("") webpage_fh.write("") webpage_fh.close() print ""
" line_b = " " line_c = "