Added new transformation preview size setting

This commit is contained in:
Roberto Rosario
2011-03-10 00:24:18 -04:00
parent d3dce59c91
commit ed5578832f
5 changed files with 8 additions and 1 deletions

View File

@@ -50,6 +50,7 @@ PREVIEW_SIZE = getattr(settings, 'DOCUMENTS_PREVIEW_SIZE', '640x480')
MULTIPAGE_PREVIEW_SIZE = getattr(settings, 'DOCUMENTS_MULTIPAGE_PREVIEW_SIZE', '160x120')
THUMBNAIL_SIZE = getattr(settings, 'DOCUMENTS_THUMBNAIL_SIZE', '50x50')
DISPLAY_SIZE = getattr(settings, 'DOCUMENTS_DISPLAY_SIZE', '1200')
TRANFORMATION_PREVIEW_SIZE = getattr(settings, 'DOCUMENTS_TRANFORMATION_PREVIEW_SIZE', '640x480')
# Transformations
AVAILABLE_TRANSFORMATIONS = getattr(settings, 'DOCUMENTS_AVAILABLE_TRANSFORMATIONS', available_transformations)

View File

@@ -33,7 +33,7 @@ class DocumentPageImageWidget(forms.widgets.Widget):
def render(self, name, value, attrs=None):
output = []
output.append('<img src="%(img)s?page=%(page)s" />' % {
'img':reverse('document_preview', args=[value.document.id]),
'img':reverse('document_preview_transformation', args=[value.document.id]),
'page':value.page_number,
})
#output.append(super(ImageWidget, self).render(name, value, attrs))

View File

@@ -6,6 +6,7 @@ from documents.conf.settings import PREVIEW_SIZE
from documents.conf.settings import THUMBNAIL_SIZE
from documents.conf.settings import DISPLAY_SIZE
from documents.conf.settings import MULTIPAGE_PREVIEW_SIZE
from documents.conf.settings import TRANFORMATION_PREVIEW_SIZE
from documents.conf.settings import ENABLE_SINGLE_DOCUMENT_UPLOAD
from converter.api import QUALITY_HIGH
@@ -21,10 +22,13 @@ urlpatterns = patterns('documents.views',
url(r'^document/(?P<document_id>\d+)/delete/$', 'document_delete', (), 'document_delete'),
url(r'^document/(?P<document_id>\d+)/edit/$', 'document_edit', (), 'document_edit'),
url(r'^document/(?P<document_id>\d+)/edit/metadata/$', 'document_edit_metadata', (), 'document_edit_metadata'),
url(r'^document/(?P<document_id>\d+)/display/preview/$', 'get_document_image', {'size':PREVIEW_SIZE}, 'document_preview'),
url(r'^document/(?P<document_id>\d+)/display/preview/multipage/$', 'get_document_image', {'size':MULTIPAGE_PREVIEW_SIZE}, 'document_preview_multipage'),
url(r'^document/(?P<document_id>\d+)/display/preview/transformation/$', 'get_document_image', {'size':TRANFORMATION_PREVIEW_SIZE}, 'document_preview_transformation'),
url(r'^document/(?P<document_id>\d+)/display/thumbnail/$', 'get_document_image', {'size':THUMBNAIL_SIZE}, 'document_thumbnail'),
url(r'^document/(?P<document_id>\d+)/display/$', 'get_document_image', {'size':DISPLAY_SIZE,'quality':QUALITY_HIGH}, 'document_display'),
url(r'^document/(?P<document_id>\d+)/download/$', 'document_download', (), 'document_download'),
url(r'^document/(?P<document_id>\d+)/create/siblings/$', 'document_create_sibling', {'multiple':True if ENABLE_SINGLE_DOCUMENT_UPLOAD == False else False}, 'document_create_sibling'),
url(r'^document/(?P<document_id>\d+)/find_duplicates/$', 'document_find_duplicates', (), 'document_find_duplicates'),

View File

@@ -31,6 +31,7 @@ from documents.conf.settings import USE_STAGING_DIRECTORY
from documents.conf.settings import STAGING_FILES_PREVIEW_SIZE
from documents.conf.settings import PREVIEW_SIZE
from documents.conf.settings import THUMBNAIL_SIZE
from documents.conf.settings import TRANFORMATION_PREVIEW_SIZE
from documents.conf.settings import GROUP_MAX_RESULTS
from documents.conf.settings import GROUP_SHOW_EMPTY
from documents.conf.settings import GROUP_SHOW_THUMBNAIL

View File

@@ -211,6 +211,7 @@ LOGIN_EXEMPT_URLS = (
#DOCUMENTS_THUMBNAIL_SIZE = '50x50'
#DOCUMENTS_DISPLAY_SIZE = '1200'
#DOCUMENTS_MULTIPAGE_PREVIEW_SIZE = '160x120'
#DOCUMENTS_TRANFORMATION_PREVIEW_SIZE = '640x480'
#DOCUMENTS_AVAILABLE_TRANSFORMATIONS = {}
#example: DOCUMENTS_DEFAULT_TRANSFORMATIONS = [{'name':'rotate', 'arguments':"{'degrees':270}"}]