From cf351a7af9f568386499f3d02c83fad29a02c848 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 10 Sep 2014 22:30:32 +0100 Subject: [PATCH] Fix thumbnail creating --- openlp/core/lib/imagemanager.py | 2 +- openlp/core/lib/serviceitem.py | 3 ++- openlp/plugins/images/lib/mediaitem.py | 4 ++-- openlp/plugins/remotes/html/openlp.js | 2 +- openlp/plugins/remotes/lib/httprouter.py | 5 ++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 0d8d488fd..ecbfd58f9 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -280,7 +280,7 @@ class ImageManager(QtCore.QObject): """ Add image to cache if it is not already there. """ - log.debug('add_image %s' % path) + log.debug('add_image path: %s, source: %s, width: %d, height: %d ' % (path, source, width, height)) if not (path, source, width, height) in self._cache: image = Image(path, source, background, width, height) self._cache[(path, source, width, height)] = image diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 079c0a0bd..7332cea1f 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -302,7 +302,8 @@ class ServiceItem(RegistryProperties): thumbnail = os.path.join(AppLocation.get_section_data_path('images'), 'thumbnails', os.path.split(path)[1]) create_thumb(path, thumbnail, False) self._raw_frames.append({'title': title, 'path': path, 'image': thumbnail}) - self.image_manager.add_image(thumbnail, ImageSource.ImagePlugin, self.image_border) + self.image_manager.add_image(thumbnail, ImageSource.ImagePlugin, self.image_border, 88, 88) + self.image_manager.add_image(thumbnail, ImageSource.ImagePlugin, self.image_border, 320, 240) self.image_manager.add_image(path, ImageSource.ImagePlugin, self.image_border) self._new_item() diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index d5892c250..d35394ad6 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -34,7 +34,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.common import Registry, AppLocation, Settings, UiStrings, check_directory_exists, translate from openlp.core.lib import ItemCapabilities, MediaManagerItem, ServiceItemContext, StringContent, TreeWidgetWithDnD,\ - build_icon, check_item_selected, create_thumb, validate_thumb + build_icon, check_item_selected, create_thumb, validate_thumb, ImageSource from openlp.core.lib.ui import create_widget_action, critical_error_message_box from openlp.core.utils import delete_file, get_locale_key, get_images_filter from openlp.plugins.images.forms import AddGroupForm, ChooseGroupForm @@ -590,7 +590,7 @@ class ImageMediaItem(MediaManagerItem): # Continue with the existing images. for filename in images_file_names: name = os.path.split(filename)[1] - service_item.add_from_image(filename, name, background, os.path.join(self.service_path, name)) + service_item.add_from_image(filename, ImageSource.ImagePlugin, background, os.path.join(self.service_path, name)) return True def check_group_exists(self, new_group): diff --git a/openlp/plugins/remotes/html/openlp.js b/openlp/plugins/remotes/html/openlp.js index 5dd8cee0e..ba2ffdf05 100644 --- a/openlp/plugins/remotes/html/openlp.js +++ b/openlp/plugins/remotes/html/openlp.js @@ -99,7 +99,7 @@ window.OpenLP = { text += ("
" + slide["notes"] + "
"); text = text.replace(/\n/g, '
'); if (slide["img"]) - text += ""; + text += ""; var li = $("
  • ").append( $("").html(text)); if (slide["selected"]) { diff --git a/openlp/plugins/remotes/lib/httprouter.py b/openlp/plugins/remotes/lib/httprouter.py index 7d3609784..a5d42fd18 100644 --- a/openlp/plugins/remotes/lib/httprouter.py +++ b/openlp/plugins/remotes/lib/httprouter.py @@ -125,7 +125,7 @@ from mako.template import Template from PyQt4 import QtCore from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, translate -from openlp.core.lib import PluginStatus, StringContent, image_to_byte, ItemCapabilities +from openlp.core.lib import PluginStatus, StringContent, image_to_byte, ItemCapabilities, ImageSource log = logging.getLogger(__name__) FILE_TYPES = { @@ -406,9 +406,8 @@ class HttpRouter(RegistryProperties): full_path = os.path.normpath(os.path.join(AppLocation.get_section_data_path(controller_name), 'thumbnails/' + full_path)) if os.path.exists(full_path): - path, just_file_name = os.path.split(full_path) ext, content_type = self.get_content_type(full_path) - image = self.image_manager.get_image(full_path, just_file_name, width, height) + image = self.image_manager.get_image(full_path, ImageSource.ImagePlugin , width, height) content = image_to_byte(image, False) if len(content) == 0: return self.do_not_found()