views:

361

answers:

2

Hi guys, i dont know what im doing wrong, but sorl-thumb just upload the image but dont make thumbs...

model.py

 from sorl.thumbnail.fields import ImageWithThumbnailsField ,ThumbnailField

 imagen = ImageWithThumbnailsField(upload_to='images',
                                      thumbnail={'size': (75, 75)},
                                      extra_thumbnails={'icon': {'size': (25, 25),'options': ['crop', 'upscale']},
                                                        'large': {'size': (200, 400)},
                                                        },
                                    )

setting

'sorl.thumbnail',

What more i need guys?, im followed the doc's.

Thanks

A: 

I dont know sorl, but I would say, you need to add ImageWithThumbnailsField as a field inside a model

class MyImage(models.Model):
    image = ImageWithThumbnailsField(upload_to='images',
                                      thumbnail={'size': (75, 75)},
                                      extra_thumbnails={'icon': {'size': (25, 25),'options': ['crop', 'upscale']},
                                                        'large': {'size': (200, 400)},
                                                        },
                                    )
    name= models.CharField(maxlength=100)

ImageWithThumbnailsField in sorl-documentation

vikingosegundo
yes man sorry but is there, just i dont copy the model class, but is there :)
Asinox
did it answer ur question?
vikingosegundo
ah, now i understand, what u wanted to say
vikingosegundo
+1  A: 

Did you read the documentation on when thumbnails are created?

You haven't actually explained exactly what your problem is. Edit your original question to show something you are trying to do (along with both the actual and expected results).

EDIT: As the docs say, your images are not created until they are used. If you want thumbs to be generated when the image is initially uploaded, use the generate_on_save attribute like this:

ImageWithThumbnailsField(..., generate_on_save=True)
SmileyChris
SmileyChris well, i dont know if im wrong but my problem is that sorl dont make thumbs when im trying to upload the file... but is fine...the real good thing here is for me is using in the Template :)
Asinox
Edited the comment to reiterate what was already said in the documentation.
SmileyChris
Thanks :), i never saw this in the doc's jeje, thanks :)
Asinox