Ejemplo n.º 1
0
 def get(self, request, *args, **kwargs):
     path = request.GET.get('path')
     if path and is_my_file(path):
         try:
             filename = make_thumbnail(path, 64, 64)
         except Exception:
             pass
         else:
             return HttpResponseRedirect(filename)
     raise Http404
Ejemplo n.º 2
0
 def thumbnail(self, obj):
     if obj.relative_img_path:
         if is_my_file(obj.relative_img_path):
             try:
                 filename = make_thumbnail(obj.relative_img_path, 64, 64)
             except Exception:
                 return ""
         else:
             filename = self.request_remote_thumbnail(obj.relative_img_path)
         return '<img alt="" src="%s" />' % (filename,)
     return ""
Ejemplo n.º 3
0
 def logo(self, obj):
     if obj.logo_image:
         try:
             filename = make_thumbnail(obj.logo_image,
                                       0,
                                       0,
                                       use_storage=global_storage)
         except Exception:
             return ''
         return '<img alt="" width="64" src="%s" />' % (filename, )
     return ''
Ejemplo n.º 4
0
 def thumbnail(self, obj):
     if obj.relative_img_path:
         if is_my_file(obj.relative_img_path):
             try:
                 filename = make_thumbnail(obj.relative_img_path, 64, 64)
             except Exception:
                 return ''
         else:
             filename = self.request_remote_thumbnail(obj.relative_img_path)
         return '<img alt="" src="%s" />' % (filename,)
     return ''