Show thumbnail image in daily work summary (#10605)
* Show thumbnail image in daily work summary * Crop thumbnail image into square * fix codacy
This commit is contained in:
parent
e78d5a240a
commit
aebcb17daf
@ -51,6 +51,25 @@ class DailyWorkSummary(Document):
|
||||
|
||||
d.sender_name = emp[0].employee_name if emp else d.sender
|
||||
d.image = emp[0].image if emp and emp[0].image else None
|
||||
|
||||
original_image = d.image
|
||||
# make thumbnail image
|
||||
try:
|
||||
if original_image:
|
||||
file_name = frappe.get_list('File', {'file_url': original_image})
|
||||
|
||||
if file_name:
|
||||
file_name = file_name[0].name
|
||||
file_doc = frappe.get_doc('File', file_name)
|
||||
thumbnail_image = file_doc.make_thumbnail(
|
||||
set_as_thumbnail=False,
|
||||
width=100,
|
||||
height=100,
|
||||
crop=True
|
||||
)
|
||||
d.image = thumbnail_image
|
||||
except:
|
||||
d.image = original_image
|
||||
|
||||
if d.sender in did_not_reply:
|
||||
did_not_reply.remove(d.sender)
|
||||
|
Loading…
x
Reference in New Issue
Block a user