How to get thumbnail in python code in version 3.2.5 from Sorl thumbnail?

Sorl's thumbnail documentation still refers to the function get_thumbnail, but this does not exist in v.3.2.5. ( cannot import name get_thumbnail)

Throughout my life I can’t find a link to why this function was changed, or how to create a sketch in the python code of this version of sorl. Any tips?

+3
source share
2 answers

In my specific case, I used a ThumbnailField with extra_thumbnails:

class SomeModel(models.Model):
    # other kwargs omitted for clarity
    image = ThumbnailField(extra_thumbnails={
                           'inline_preview': {'size': (600,400)},
                           'small_thumb': {'size': (75,75), 'options':['crop', 'sharpen']})

The field imagewill be a pointer image defined option extra_thumbnails, as an attribute, title, unexpectedly extra_thumbails:

somemodel_instance.image.extra_thumbnails['inline_preview']
+2
source

, , , , , . URL-, , :

from solr.thumbnail.main import DjangoThumbnail

img = imageObject # a normal image url returned from an ImageField
size = (100,100) # any tuple 
img_resize_url = unicode(DjangoThumbnail(img, size))

, , , , extra_thumbnails. , , , .

+1

All Articles