Use base64 as the default document image representation

This commit is contained in:
Roberto Rosario
2015-06-08 01:16:01 -04:00
parent b256758db2
commit 3fc7147f93
3 changed files with 18 additions and 20 deletions

View File

@@ -263,14 +263,22 @@
$('.scrollable').scrollview();
$('a.fancybox').fancybox({
openEffect : 'elastic',
closeEffect : 'elastic',
prevEffect : 'none',
nextEffect : 'none',
titleShow : true,
type : 'image',
autoResize : true,
$('a.fancybox').on('click', function (e) {
e.preventDefault();
$.ajax({
type: 'get',
cache: false,
url: $(this).attr('href'),
success: function (data) {
$.fancybox.open({
href : data,
showLoading: true,
openEffect : 'elastic',
closeEffect : 'elastic',
});
}
});
});
$('a.fancybox-staging').click(function(e) {

View File

@@ -13,8 +13,6 @@ from django.template import RequestContext
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _, ungettext
import sendfile
from acls.models import AccessEntry
from acls.views import acl_list_for
from common.compressed_files import CompressedFile
@@ -369,15 +367,8 @@ def get_document_image(request, document_id, size=PREVIEW_SIZE):
document_page = document.pages.get(page_number=page)
task = task_get_document_page_image.apply_async(kwargs=dict(document_page_id=document_page.pk, size=size, zoom=zoom, rotation=rotation, as_base64=False, version=version), queue='converter')
data = task.get(timeout=DOCUMENT_IMAGE_TASK_TIMEOUT)
return HttpResponse(data, content_type='image')
# TODO: remove sendfile
# TODO: test if celery result store can store binary blobs or switch to
# full base64 in JS
#return sendfile.sendfile(request, task.get(timeout=DOCUMENT_IMAGE_TASK_TIMEOUT), mimetype=DEFAULT_FILE_FORMAT_MIMETYPE)
task = task_get_document_page_image.apply_async(kwargs=dict(document_page_id=document_page.pk, size=size, zoom=zoom, rotation=rotation, as_base64=True, version=version), queue='converter')
return HttpResponse(task.get(timeout=DOCUMENT_IMAGE_TASK_TIMEOUT), content_type='image')
def document_download(request, document_id=None, document_id_list=None, document_version_pk=None):

View File

@@ -14,7 +14,6 @@ django-pagination==1.0.7
django-model-utils==2.2
django-mptt==0.7.4
django-rest-swagger==0.3.1
django-sendfile==0.3.7
django-solo==1.1.0
django-suit==0.2.13
django-widget-tweaks==1.3