diff options
| -rw-r--r-- | ishtar_common/context_processors.py | 4 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/window_image.html | 6 | ||||
| -rwxr-xr-x | xhtml2odt/xhtml2odt.py | 10 | 
3 files changed, 15 insertions, 5 deletions
diff --git a/ishtar_common/context_processors.py b/ishtar_common/context_processors.py index ff97079d5..cc3dd5782 100644 --- a/ishtar_common/context_processors.py +++ b/ishtar_common/context_processors.py @@ -28,7 +28,9 @@ from menus import Menu  def get_base_context(request): -    dct = {'URL_PATH': settings.URL_PATH} +    dct = {'URL_PATH': settings.URL_PATH, +           'BASE_URL': "{}://{}".format( +               request.scheme, request.META['HTTP_HOST'])}      try:          dct["APP_NAME"] = Site.objects.get_current().name      except Site.DoesNotExist: diff --git a/ishtar_common/templates/ishtar/blocks/window_image.html b/ishtar_common/templates/ishtar/blocks/window_image.html index 4b8e67ea9..606b6b57a 100644 --- a/ishtar_common/templates/ishtar/blocks/window_image.html +++ b/ishtar_common/templates/ishtar/blocks/window_image.html @@ -1,8 +1,8 @@  {% if item.image %}  <div id="lightgallery-{{window_id}}"> -    <a href="{{item.image.url}}"> -        <img class='card-img-top' src="{{item.thumbnail.url}}"> -    </a> +    {% if output != "ODT" %}<a href="{{item.image.url}}">{% endif %} +        <img class='card-img-top' src="{{BASE_URL}}{{item.thumbnail.url}}"> +    {% if output != "ODT" %}</a>{% endif %}      {% comment %}      <!-- gallery test -->      <a href="{{item.image.url}}" diff --git a/xhtml2odt/xhtml2odt.py b/xhtml2odt/xhtml2odt.py index 340a980cb..0923c1d05 100755 --- a/xhtml2odt/xhtml2odt.py +++ b/xhtml2odt/xhtml2odt.py @@ -458,11 +458,19 @@ class ODTFile(object):                  log('Forced height: %spx. Size will be: %scm x %scm' %                      (height_mo.group(1), height, width), self.options.verbose)                  full_tag = full_tag.replace(height_mo.group(), "") -            else: +            elif hasattr(self.options, 'img_dpi'):                  width = width / float(self.options.img_dpi) * INCH_TO_CM                  height = height / float(self.options.img_dpi) * INCH_TO_CM                  log('Size converted to: %scm x %scm' % (height, width),                          self.options.verbose) +            elif hasattr(self.options, 'img_width'): +                ratio = float(height) / float(width) +                width = float(self.options.img_width.replace('cm', '')) +                height = ratio * width +                log('Size converted to: %scm x %scm' % (height, width), +                        self.options.verbose) +            else: +                return full_tag              full_tag = full_tag.replace('<img',                      '<img width="%scm" height="%scm"' % (width, height))          return full_tag  | 
