Document image serving uses now a fixed mimetype provided by converter.DEFAULT_FILE_FORMAT_MIMETYPE to help browser rendering

This commit is contained in:
Roberto Rosario
2011-11-22 00:57:54 -04:00
parent 4e8f2c370b
commit a6a00cbc15
2 changed files with 3 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ DEFAULT_ZOOM_LEVEL = 100
DEFAULT_ROTATION = 0
DEFAULT_PAGE_NUMBER = 1
DEFAULT_FILE_FORMAT = u'jpeg'
DEFAULT_FILE_FORMAT_MIMETYPE = u'image/jpeg'
DIMENSION_SEPARATOR = u'x'

View File

@@ -18,7 +18,7 @@ from common.literals import PAGE_SIZE_DIMENSIONS, \
PAGE_ORIENTATION_PORTRAIT, PAGE_ORIENTATION_LANDSCAPE
from common.conf.settings import DEFAULT_PAPER_SIZE
from converter.literals import DEFAULT_ZOOM_LEVEL, DEFAULT_ROTATION, \
DEFAULT_PAGE_NUMBER
DEFAULT_PAGE_NUMBER, DEFAULT_FILE_FORMAT_MIMETYPE
from converter.office_converter import OfficeConverter
from filetransfers.api import serve_file
from metadata.forms import MetadataFormSet, MetadataSelectionForm
@@ -288,7 +288,7 @@ def get_document_image(request, document_id, size=PREVIEW_SIZE):
rotation = int(request.GET.get('rotation', DEFAULT_ROTATION)) % 360
return sendfile.sendfile(request, document.get_image(size=size, page=page, zoom=zoom, rotation=rotation))
return sendfile.sendfile(request, document.get_image(size=size, page=page, zoom=zoom, rotation=rotation), mimetype=DEFAULT_FILE_FORMAT_MIMETYPE)
def document_download(request, document_id):