Remove metadata from share images

master
Bob Mottram 2019-07-24 14:21:47 +01:00
parent b181d38911
commit a26a11dd5c
1 changed files with 7 additions and 9 deletions

View File

@ -18,6 +18,7 @@ from posts import getPersonBox
from session import postJson from session import postJson
from utils import getNicknameFromActor from utils import getNicknameFromActor
from utils import getDomainFromActor from utils import getDomainFromActor
from media import removeMetaData
def removeShare(baseDir: str,nickname: str,domain: str, \ def removeShare(baseDir: str,nickname: str,domain: str, \
displayName: str) -> None: displayName: str) -> None:
@ -104,22 +105,19 @@ def addShare(baseDir: str,nickname: str,domain: str, \
os.mkdir(baseDir+'/sharefiles/'+nickname) os.mkdir(baseDir+'/sharefiles/'+nickname)
itemIDfile=baseDir+'/sharefiles/'+nickname+'/'+itemID itemIDfile=baseDir+'/sharefiles/'+nickname+'/'+itemID
if imageFilename.endswith('.png'): if imageFilename.endswith('.png'):
removeMetaData(imageFilename,itemIDfile+'.png')
if moveImage: if moveImage:
os.rename(imageFilename,itemIDfile+'.png') os.remove(imageFilename)
else:
copyfile(imageFilename,itemIDfile+'.png')
imageUrl='/sharefiles/'+nickname+'/'+itemID+'.png' imageUrl='/sharefiles/'+nickname+'/'+itemID+'.png'
if imageFilename.endswith('.jpg'): if imageFilename.endswith('.jpg'):
removeMetaData(imageFilename,itemIDfile+'.jpg')
if moveImage: if moveImage:
os.rename(imageFilename,itemIDfile+'.jpg') os.remove(imageFilename)
else:
copyfile(imageFilename,itemIDfile+'.jpg')
imageUrl='/sharefiles/'+nickname+'/'+itemID+'.jpg' imageUrl='/sharefiles/'+nickname+'/'+itemID+'.jpg'
if imageFilename.endswith('.gif'): if imageFilename.endswith('.gif'):
removeMetaData(imageFilename,itemIDfile+'.gif')
if moveImage: if moveImage:
os.rename(imageFilename,itemIDfile+'.gif') os.remove(imageFilename)
else:
copyfile(imageFilename,itemIDfile+'.gif')
imageUrl='/sharefiles/'+nickname+'/'+itemID+'.gif' imageUrl='/sharefiles/'+nickname+'/'+itemID+'.gif'
sharesJson[itemID] = { sharesJson[itemID] = {