forked from rDrama/rDrama
Fix thumbnail_thread passing uploader to media.
parent
7eefcf5308
commit
24167b1d09
|
@ -112,7 +112,7 @@ def process_video(file):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def process_image(filename=None, resize=0, trim=False, patron=False):
|
def process_image(filename=None, resize=0, trim=False, uploader=None, patron=False):
|
||||||
size = os.stat(filename).st_size
|
size = os.stat(filename).st_size
|
||||||
|
|
||||||
if size > 16 * 1024 * 1024 or not patron and size > 8 * 1024 * 1024:
|
if size > 16 * 1024 * 1024 or not patron and size > 8 * 1024 * 1024:
|
||||||
|
@ -177,7 +177,7 @@ def process_image(filename=None, resize=0, trim=False, patron=False):
|
||||||
media = Media(
|
media = Media(
|
||||||
kind='image',
|
kind='image',
|
||||||
filename=filename.split('/')[-1],
|
filename=filename.split('/')[-1],
|
||||||
user_id=g.v.id,
|
user_id=uploader or g.v.id,
|
||||||
size=os.stat(filename).st_size
|
size=os.stat(filename).st_size
|
||||||
)
|
)
|
||||||
g.db.add(media)
|
g.db.add(media)
|
||||||
|
|
|
@ -598,7 +598,7 @@ def thumbnail_thread(pid):
|
||||||
for chunk in image_req.iter_content(1024):
|
for chunk in image_req.iter_content(1024):
|
||||||
file.write(chunk)
|
file.write(chunk)
|
||||||
|
|
||||||
post.thumburl = process_image(name, resize=100)
|
post.thumburl = process_image(name, resize=100, uploader=post.author_id)
|
||||||
db.add(post)
|
db.add(post)
|
||||||
db.commit()
|
db.commit()
|
||||||
db.close()
|
db.close()
|
||||||
|
|
Loading…
Reference in New Issue