swap ignoreext to be default

This commit is contained in:
Colin Davis 2011-08-30 16:35:59 -04:00
parent e6ffbc129e
commit e63cf6c611

View File

@ -227,10 +227,21 @@ class ImgHandler(tornado.web.RequestHandler):
else: else:
client_ignoreext = None client_ignoreext = None
if client_ignoreext == "true":
#Change to a usuable format
if string.endswith(('.png','.gif','.jpg','.bmp','.im','.jpeg','.pcx','.ppm','.tiff','.xbm','tif')):
ext = string[string.rfind('.') +1 :len(string)]
if ext.lower() == 'jpg':
ext = 'jpeg'
if ext.lower() == 'tif':
ext = 'tiff'
else:
ext = "png"
if client_ignoreext != "false":
if string.endswith(('.png','.gif','.jpg','.bmp','.im','.jpeg','.pcx','.ppm','.tiff','.xbm','tif')): if string.endswith(('.png','.gif','.jpg','.bmp','.im','.jpeg','.pcx','.ppm','.tiff','.xbm','tif')):
string = string[0:string.rfind('.')] string = string[0:string.rfind('.')]
print string
r = Robohash(string) r = Robohash(string)
@ -295,15 +306,7 @@ class ImgHandler(tornado.web.RequestHandler):
client_set = colors[r.hasharray[0] % len(colors) ] client_set = colors[r.hasharray[0] % len(colors) ]
#Change to a usuable format
if string.endswith(('.png','.gif','.jpg','.bmp','.im','.jpeg','.pcx','.ppm','.tiff','.xbm','tif')):
ext = string[string.rfind('.') +1 :len(string)]
if ext.lower() == 'jpg':
ext = 'jpeg'
if ext.lower() == 'tif':
ext = 'tiff'
else:
ext = "png"
self.set_header("Content-Type", "image/" + ext) self.set_header("Content-Type", "image/" + ext)
hashlist = r.getHashList(client_set) hashlist = r.getHashList(client_set)