From e2334f5d92fffacf55381764b0066a6d92661f56 Mon Sep 17 00:00:00 2001
From: Daniel Neuwirth <daniel.neuwirth@dataport.de>
Date: Thu, 21 Nov 2019 14:13:03 +0000
Subject: [PATCH] first stage

---
 ckanext/odsh/pdf_to_thumbnail/thumbnail.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ckanext/odsh/pdf_to_thumbnail/thumbnail.py b/ckanext/odsh/pdf_to_thumbnail/thumbnail.py
index 6d653664..5f87dbf9 100644
--- a/ckanext/odsh/pdf_to_thumbnail/thumbnail.py
+++ b/ckanext/odsh/pdf_to_thumbnail/thumbnail.py
@@ -69,7 +69,8 @@ def create_thumbnail_from_file(file, old_filename):
         if os.path.exists(old_filepath):
             os.remove(old_filepath)
     convert_from_bytes(file_read,
-                       size=(width, None),
+                       dpi = 50,
+                       #size=(width, None),
                        output_folder=directory,
                        output_file=filename,
                        single_file=True,
@@ -81,7 +82,11 @@ def create_thumbnail_from_file(file, old_filename):
 
 
 def create_thumbnail_from_url(resource, old_filename):
-    return False, None, None
+    resource_url = resource.get('url')
+    response = urllib2.urlopen(resource_url)
+    if response.code == 200:
+        file = response.read()
+    return False, None
 '''
     #  Requests does not work on a server but on a local test enviroment.
     #  With the given configuration of a wsgi server and apache it did not work
-- 
GitLab