I played with sorl-thumbnail for Django. And trying to figure out how it works better.
I read the manual for it, installed it in my site packages, made sure that PIL is installed correctly, put sorl.thumbnail in INSTALLED APPS in my settings.py , put from sorl.thumbnail.fields import ImageWithThumbnailsField at the top in my models.py , added image = ImageWithThumbnailsField(upload to="images/", thumbnail={'size':(80, 80)}) as one of my model fields, passed the model through my view to the template and in the added template {% load thumbnail %} at the top and add the {{ mymodel.image.thumbnail_tag }} variable there.
But from what I understood, is that when I upload an image through the administrator, it will immediately create a thumbnail, but in fact it is created only when I see my template in the browser? It's right? The thumbnail shows that it actually looks great, but I thought that adding part of the model field could create a sketch right after loading the image? ... Why not just use models.ImageField in my model?
... or did I do it all OK, and I just made it work incorrectly?
python django image-processing
littlejim84
source share