From 960f9745ae87bfe9f346695cc3dd584dd4515466 Mon Sep 17 00:00:00 2001 From: Mustafa Yontar Date: Mon, 1 Feb 2021 11:42:55 +0300 Subject: [PATCH] thumb no size --- restapi/resource.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/restapi/resource.py b/restapi/resource.py index df0a8d9..e6dc975 100644 --- a/restapi/resource.py +++ b/restapi/resource.py @@ -128,17 +128,20 @@ class Resource: if self.base64_image and value: if self.base64_image_as_full: file = b64encode(value.read()).decode("utf-8") + return { + "size": value.size, + "upload_date": value.gridout.upload_date, + "format": value.format, + "base64": file + } else: - try: - file = b64encode(value.thumbnail.read()).decode("utf-8") - except: - file = b64encode(value.read()).decode("utf-8") - return { - "size": value.size, - "upload_date": value.gridout.upload_date, - "format": value.format, - "base64": file - } + file = b64encode(value.thumbnail.read()).decode("utf-8") + + return { + "upload_date": value.gridout.upload_date, + "format": value.format, + "base64": file + } else: if value: return {