import os

from sorl.thumbnail import get_thumbnail

from ajaxuploader.backends.local import LocalUploadBackend

class ThumbnailUploadBackend(LocalUploadBackend):
    def __init__(self, dimension):
        self._dimension = dimension
    
    def upload_complete(self, request, filename):
        thumbnail = get_thumbnail(self._filename, self._dimension)
        os.unlink(self._filename)
        return {"path": thumbnail.name}

import os

from django.conf import settings
from sorl.thumbnail import get_thumbnail

from ajaxuploader.backends.local import LocalUploadBackend

class ThumbnailUploadBackend(LocalUploadBackend):
    DIMENSION = "100x100"

    def upload_complete(self, request, filename):
        thumbnail = get_thumbnail(self._path, self.DIMENSION)
        os.unlink(self._path)
        return {"path": settings.MEDIA_URL + thumbnail.name}

Use dimension as a constant, so we keep same interface for all backends; also returns full path to the place where image was saved
Use dimension as a constant, so we keep same interface for all backends; also returns full path to the place where image was saved
