In Django, how to get django repositories, boto and easy_thumbnail to work well?

I create a site where files are uploaded through the administrator, and then it will store them on Amazon S3. I am using django-storageages and boto for this, and it seems to work fine.

Thing is, I'm used to using my easy_thumbnails (new sorl.thumbnail) on the template side to sketch on the fly. I prefer this approach rather than the model side, as it allows me to simplify maintenance if I ever decide to resize thumbnails to a later date, etc.

But I understand that easy_thumbnails does not seem to like reading the image, which is now stored on Amazon S3. In addition, I realized where exactly this will make the sketches, once made in one way or another? Obviously, I would prefer them to be on Amazon S3 too. But how do I get these two technologies to play well?

How do I get easy_thumbnails to hold the thumb that it creates on Amazon S3? Or am I just looking at it wrong ?!

Thank!

+5
source share
2 answers

easy_thumbnails S3 - settings.THUMBNAIL_DEFAULT_STORAGE, easy_thumbnails , ( , , , ImageFields).

+16

...

, :

class Photo(models.Model)
    image = models.ImageField(upload_to=image_upload_to)
    thumb_a = ThumbnailerImageField(upload_to=thumb_a_upload_to, resize_source=dict(size=(98,98), crop='center'),)

, :

{% load thumbnail %}
<img src="{% thumbnail photo.image 98x98 crop='center' %}">

...

<img src="{{photo.thumb_b.url}}">

, ...

for i in listOfImages:
    form = CreatePhotoForm(request.POST, i)
        if form.is_valid():
            asdf = form.save(commit=False)
            asdf.owner = request.user
            asdf.image = i
            asdf.thumb_a = i
            asdf.title = str(i)
            asdf.save()

.

-1

All Articles