|
|
@ -128,13 +128,16 @@ class Resource: |
|
|
|
if self.base64_image and value: |
|
|
|
if self.base64_image and value: |
|
|
|
if self.base64_image_as_full: |
|
|
|
if self.base64_image_as_full: |
|
|
|
file = b64encode(value.read()).decode("utf-8") |
|
|
|
file = b64encode(value.read()).decode("utf-8") |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
"size": value.size, |
|
|
|
|
|
|
|
"upload_date": value.gridout.upload_date, |
|
|
|
|
|
|
|
"format": value.format, |
|
|
|
|
|
|
|
"base64": file |
|
|
|
|
|
|
|
} |
|
|
|
else: |
|
|
|
else: |
|
|
|
try: |
|
|
|
|
|
|
|
file = b64encode(value.thumbnail.read()).decode("utf-8") |
|
|
|
file = b64encode(value.thumbnail.read()).decode("utf-8") |
|
|
|
except: |
|
|
|
|
|
|
|
file = b64encode(value.read()).decode("utf-8") |
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
"size": value.size, |
|
|
|
|
|
|
|
"upload_date": value.gridout.upload_date, |
|
|
|
"upload_date": value.gridout.upload_date, |
|
|
|
"format": value.format, |
|
|
|
"format": value.format, |
|
|
|
"base64": file |
|
|
|
"base64": file |
|
|
|