Fix document previews
This commit is contained in:
@@ -122,12 +122,13 @@ def convert(input_filepath, size, quality=QUALITY_DEFAULT, page=0, file_format=u
|
||||
if os.path.exists(output_filepath):
|
||||
return output_filepath
|
||||
|
||||
#if document.file_extension.lower() in CONVERTER_OFFICE_FILE_EXTENSIONS:
|
||||
# result = convert_office_document(input_filepath)
|
||||
# if result:
|
||||
# unoconv_output = result
|
||||
# input_filepath = result
|
||||
# extra_options = u''
|
||||
path, extension = os.path.splitext(input_filepath)
|
||||
if extension[1:].lower() in CONVERTER_OFFICE_FILE_EXTENSIONS:
|
||||
result = convert_office_document(input_filepath)
|
||||
if result:
|
||||
unoconv_output = result
|
||||
input_filepath = result
|
||||
extra_options = u''
|
||||
|
||||
input_arg = u'%s[%s]' % (input_filepath, page)
|
||||
extra_options += u' -resize %s' % size
|
||||
|
||||
@@ -17,7 +17,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
|
||||
import sendfile
|
||||
from common.utils import pretty_size
|
||||
from converter.api import convert, QUALITY_DEFAULT
|
||||
from converter.api import convert_document, QUALITY_DEFAULT
|
||||
from converter.exceptions import UnkownConvertError, UnknownFormat
|
||||
from filetransfers.api import serve_file
|
||||
from filesystem_serving.api import document_create_fs_links, document_delete_fs_links
|
||||
@@ -547,7 +547,7 @@ def get_document_image(request, document_id, size=PREVIEW_SIZE, quality=QUALITY_
|
||||
|
||||
rotation = int(request.GET.get('rotation', 0)) % 360
|
||||
|
||||
output_file = convert(document, size=size, file_format=u'jpg', quality=quality, extra_options=transformation_string, page=page - 1, zoom=zoom, rotation=rotation)
|
||||
output_file = convert_document(document, size=size, file_format=u'jpg', quality=quality, extra_options=transformation_string, page=page - 1, zoom=zoom, rotation=rotation)
|
||||
except UnkownConvertError, e:
|
||||
if request.user.is_staff or request.user.is_superuser:
|
||||
messages.error(request, e)
|
||||
|
||||
Reference in New Issue
Block a user