]> git.parisson.com Git - telemeta.git/commitdiff
Serve images through Nginx
authorThomas Fillon <thomas@parisson.com>
Fri, 14 Apr 2017 11:56:41 +0000 (13:56 +0200)
committerThomas Fillon <thomas@parisson.com>
Fri, 14 Apr 2017 11:56:41 +0000 (13:56 +0200)
telemeta/views/item.py

index 2f6c73c7a85a2968f556a0ab0f06721d1ac11a36..ed0c6e41e68e4dad9a8d55f7ef53d8a1f8d489e1 100644 (file)
@@ -259,10 +259,10 @@ class ItemView(ItemBaseMixin):
         if 'waveform_centroid' in grapher_id and self.cache_data.exists(old_image_file):
             image_file = old_image_file
 
+        path = self.cache_data.dir + os.sep + image_file    
         if not self.cache_data.exists(image_file):
             source, _ = item.get_source()
             if source:
-                path = self.cache_data.dir + os.sep + image_file
                 decoder = timeside.core.get_processor('file_decoder')(source)
                 graph = grapher(width=width, height=height)
                 (decoder | graph).run()
@@ -272,7 +272,7 @@ class ItemView(ItemBaseMixin):
                 #f.close()
                 self.cache_data.add_file(image_file)
 
-        response = StreamingHttpResponse(self.cache_data.read_stream_bin(image_file), content_type=mime_type)
+        response = serve_media(path, content_type=mime_type)
         return response
 
     def list_export_extensions(self):