Commit 437481dc authored by Ivan Tyagov's avatar Ivan Tyagov

Make it a global method so it can be used by OOoDocument (work in progress).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37216 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6c7852d7
......@@ -54,6 +54,10 @@ from zLOG import LOG, WARNING
from Products.ERP5.mixin.text_convertable import TextConvertableMixin
from Products.CMFCore.utils import getToolByName
def getDefaultImageQuality(portal, format=None):
preference_tool = portal.portal_preferences
return preference_tool.getPreference('preferred_image_quality', DEFAULT_IMAGE_QUALITY)
class Image(TextConvertableMixin, File, OFSImage):
"""
An Image is a File which contains image data. It supports
......@@ -337,6 +341,7 @@ class Image(TextConvertableMixin, File, OFSImage):
quality = kw.get('quality', _MARKER)
if quality is _MARKER:
quality = self.getDefaultImageQuality(format)
#print "image._convert", kw, quality, self.getRelativeUrl(), self.getPortalType()
convert_kw = {'quality': quality,
'resolution': kw.get('resolution'),
'frame': kw.get('frame'),
......@@ -483,6 +488,4 @@ class Image(TextConvertableMixin, File, OFSImage):
"""
Get default image quality for a format.
"""
preference_tool = self.getPortalObject().portal_preferences
quality = preference_tool.getPreference('preferred_image_quality', DEFAULT_IMAGE_QUALITY)
return quality
return getDefaultImageQuality(self.getPortalObject(), format)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment