Extract image from post

main2
Bob Mottram 2019-11-09 21:08:48 +00:00
parent dcc3683133
commit dd5fdfa192
1 changed files with 43 additions and 42 deletions

View File

@ -2686,7 +2686,7 @@ class PubServer(BaseHTTPRequestHandler):
postValue+='\n' postValue+='\n'
postValue+=postLines[line] postValue+=postLines[line]
fields[postKey]=postValue fields[postKey]=postValue
else: if imageLocation>-1:
# directly search the binary array for the beginning # directly search the binary array for the beginning
# of an image # of an image
extensionList=['png','jpeg','gif','mp4','webm','ogv','mp3','ogg'] extensionList=['png','jpeg','gif','mp4','webm','ogv','mp3','ogg']
@ -2709,9 +2709,10 @@ class PubServer(BaseHTTPRequestHandler):
self.server.baseDir+'/accounts/'+ \ self.server.baseDir+'/accounts/'+ \
nickname+'@'+self.server.domain+'/upload' nickname+'@'+self.server.domain+'/upload'
if imageLocation>-1: if imageLocation>-1:
imageFound=True
if extension=='jpeg': if extension=='jpeg':
extension='jpg' extension='jpg'
if extension=='mpeg': elif extension=='mpeg':
extension='mp3' extension='mp3'
filename=filenameBase+'.'+extension filename=filenameBase+'.'+extension
attachmentMediaType= \ attachmentMediaType= \