diff --git a/apps/documents/conf/settings.py b/apps/documents/conf/settings.py index b1df5c02d6..1abd6200bd 100644 --- a/apps/documents/conf/settings.py +++ b/apps/documents/conf/settings.py @@ -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) diff --git a/apps/documents/forms.py b/apps/documents/forms.py index ca2e6f3816..a1a34a0ef6 100644 --- a/apps/documents/forms.py +++ b/apps/documents/forms.py @@ -33,7 +33,7 @@ class DocumentPageImageWidget(forms.widgets.Widget): def render(self, name, value, attrs=None): output = [] output.append('' % { - '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)) diff --git a/apps/documents/urls.py b/apps/documents/urls.py index a9e6be1a7d..a7c0f92a7b 100644 --- a/apps/documents/urls.py +++ b/apps/documents/urls.py @@ -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\d+)/delete/$', 'document_delete', (), 'document_delete'), url(r'^document/(?P\d+)/edit/$', 'document_edit', (), 'document_edit'), url(r'^document/(?P\d+)/edit/metadata/$', 'document_edit_metadata', (), 'document_edit_metadata'), + url(r'^document/(?P\d+)/display/preview/$', 'get_document_image', {'size':PREVIEW_SIZE}, 'document_preview'), url(r'^document/(?P\d+)/display/preview/multipage/$', 'get_document_image', {'size':MULTIPAGE_PREVIEW_SIZE}, 'document_preview_multipage'), + url(r'^document/(?P\d+)/display/preview/transformation/$', 'get_document_image', {'size':TRANFORMATION_PREVIEW_SIZE}, 'document_preview_transformation'), url(r'^document/(?P\d+)/display/thumbnail/$', 'get_document_image', {'size':THUMBNAIL_SIZE}, 'document_thumbnail'), url(r'^document/(?P\d+)/display/$', 'get_document_image', {'size':DISPLAY_SIZE,'quality':QUALITY_HIGH}, 'document_display'), + url(r'^document/(?P\d+)/download/$', 'document_download', (), 'document_download'), url(r'^document/(?P\d+)/create/siblings/$', 'document_create_sibling', {'multiple':True if ENABLE_SINGLE_DOCUMENT_UPLOAD == False else False}, 'document_create_sibling'), url(r'^document/(?P\d+)/find_duplicates/$', 'document_find_duplicates', (), 'document_find_duplicates'), diff --git a/apps/documents/views.py b/apps/documents/views.py index a72f585313..193da2293c 100644 --- a/apps/documents/views.py +++ b/apps/documents/views.py @@ -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 diff --git a/settings.py b/settings.py index ab74642e24..d80fd22665 100644 --- a/settings.py +++ b/settings.py @@ -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}"}]