Skip to content

Commit

Permalink
[Fixes #4579] Set Thumbnail tool broken (GeoExplorer only)
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Jun 26, 2019
1 parent f2decb2 commit 7e70279
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
18 changes: 15 additions & 3 deletions geonode/geoserver/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1913,8 +1913,22 @@ def _prepare_thumbnail_body_from_opts(request_body, request=None):
from geonode.utils import (_v,
bbox_to_projection,
bounds_to_zoom_level)
image = None
width = 240
height = 200

if isinstance(request_body, basestring):
request_body = json.loads(request_body)
try:
request_body = json.loads(request_body)
except BaseException:
try:
image = _render_thumbnail(
request_body, width=width, height=height)
except BaseException:
image = None

if image is not None:
return image

# Defaults
_img_src_template = """<img src='{ogc_location}'
Expand All @@ -1941,10 +1955,8 @@ def decimal_encode(bbox):
if not coord:
return None

width = 240
if 'width' in request_body:
width = int(request_body['width'])
height = 200
if 'height' in request_body:
height = int(request_body['height'])
smurl = None
Expand Down
5 changes: 4 additions & 1 deletion geonode/layers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,10 @@ def create_thumbnail(instance, thumbnail_remote_url, thumbnail_create_url=None,
elif instance.alternate:
request_body['layers'] = instance.alternate

image = _prepare_thumbnail_body_from_opts(request_body)
try:
image = _prepare_thumbnail_body_from_opts(request_body)
except BaseException:
image = None

if image is None:
try:
Expand Down

0 comments on commit 7e70279

Please sign in to comment.