Implement generating "thumbnails"
This commit is contained in:
parent
74a5980cd5
commit
6e23793588
5 changed files with 15 additions and 6459 deletions
6455
src/pix360core/static/dist/css/theme.css
vendored
6455
src/pix360core/static/dist/css/theme.css
vendored
File diff suppressed because it is too large
Load diff
|
@ -155,7 +155,7 @@ function finishcard(jobid, title, video) {
|
|||
imgurl = $(this).attr("src");
|
||||
pannellum.viewer("panorama", {
|
||||
type: "equirectangular",
|
||||
panorama: imgurl,
|
||||
panorama: imgurl + "/3840/1920/",
|
||||
autoLoad: true,
|
||||
});
|
||||
$("#panoramaModal").modal("show");
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="{% static "dist/css/bootstrap.min.css" %}" type="text/css">
|
||||
<link rel="stylesheet" href="{% static "dist/css/theme.css" %}" type="text/css">
|
||||
<link rel="stylesheet" href="{% static "dist/css/pannellum.css" %}" type="text/css">
|
||||
<link rel="icon" type="image/png" href="{% static "img/favicon.png" %}">
|
||||
<title>Panorama Image Export</title>
|
||||
|
@ -132,7 +131,6 @@
|
|||
<div
|
||||
class="modal fade"
|
||||
id="panoramaModal"
|
||||
tabindex="-1"
|
||||
role="dialog"
|
||||
aria-hidden="true"
|
||||
>
|
||||
|
|
|
@ -12,4 +12,5 @@ urlpatterns = [
|
|||
path('result/<uuid:id>', ConversionResultView.as_view(), name='conversion_result'),
|
||||
path('retry/<uuid:id>', ConversionRetryView.as_view(), name='conversion_retry'),
|
||||
path('download/<uuid:id>', ConversionDownloadView.as_view(), name='conversion_download'),
|
||||
path('download/<uuid:id>/<int:width>/<int:height>/', ConversionDownloadView.as_view(), name='conversion_download_resized'),
|
||||
]
|
|
@ -6,6 +6,8 @@ from django.utils.decorators import method_decorator
|
|||
|
||||
from pix360core.models import Conversion, ConversionStatus
|
||||
|
||||
import PIL.Image
|
||||
|
||||
|
||||
class ConverterView(LoginRequiredMixin, TemplateView):
|
||||
"""View for the converter
|
||||
|
@ -168,8 +170,18 @@ class ConversionDownloadView(LoginRequiredMixin, View):
|
|||
'error': 'Conversion not done'
|
||||
}, status=404)
|
||||
|
||||
content = file.file.read()
|
||||
if "width" in kwargs:
|
||||
width = int(kwargs['width'])
|
||||
height = int(kwargs['height'])
|
||||
PIL.Image.MAX_IMAGE_PIXELS = None
|
||||
image = PIL.Image.open(file.file)
|
||||
image.thumbnail((width, height))
|
||||
image = image.convert('RGB')
|
||||
response = HttpResponse(content_type="image/jpeg")
|
||||
image.save(response, "JPEG")
|
||||
return response
|
||||
|
||||
content = file.file.read()
|
||||
response = HttpResponse(content, content_type=file.mime_type)
|
||||
response['Content-Disposition'] = f'attachment; filename="{conversion.get_result_filename()}"'
|
||||
return response
|
Loading…
Reference in a new issue