code: def serve_protected_thumbnail(request, path):
      
      source_path = thumbnail_to_original_filename(path)
      if not source_path:
          raise Http404('File not found')
      try:
          file_obj = File.objects.get(file=source_path)
      except File.DoesNotExist:
          raise Http404('File not found %s' % path)
      if not file_obj.has_read_permission(request):
          if settings.DEBUG:
              raise PermissionDenied
          else:
              raise Http404('File not found %s' % path)
      try:
          thumbnail = ThumbnailFile(name=path, storage=file_obj.file.thumbnail_storage)
          return thumbnail_server.serve(request, thumbnail, save_as=False)
      except Exception:
          raise Http404('File not found %s' % path)
docs: Serve protected thumbnails to authenticated users.
      If the user doesn't have read permissions, redirect to a static image.