コード例 #1
0
ファイル: views.py プロジェクト: gzebrowski/sample-django-app
 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
コード例 #2
0
ファイル: admin.py プロジェクト: gzebrowski/sample-django-app
 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 ""
コード例 #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 ''
コード例 #4
0
ファイル: admin.py プロジェクト: gzebrowski/sample-django-app
 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 ''