Django Model create a smaller version?

Good day in django model to create more and smaller version of the photo.

For example:
I upload base photo and wanted to save to was created 2 pictures in different sizes, and that the name is preserved in the database.

Used the "imagekit, django-stdimage" does not help. With the help of some libraries you can do
March 12th 20 at 08:04
3 answers
March 12th 20 at 08:06
Solution
And as multiple sizes to make

image = ThumbnailerImageField(
thumbnail_storage=AWSStorage(),
storage=AWSStorage(),
 resize_source=dict(size=(100, 100), sharpen=True)
 blank=True)


In settings.py
THUMBNAIL_ALIASES = {
 'image': {
 'items': {'size': (50, 50), 'crop': True},
 'item': {'size': 150},
},
}
- does not help - litzy_Kr commented on March 12th 20 at 08:09
@litzy_Kr, the best matching tag, in that moment, when the thumbnail need. - Lukas.Moore commented on March 12th 20 at 08:12
March 12th 20 at 08:08
Not sure, but maybe this battery will help ? https://github.com/respondcreate/django-versatilei...
In all cases, writes

NotImplementedError at /api/items/
subclasses of Storage must provide an exists() method


// models.py
class class:
 image = VersatileImageField(storage=AWSStorage(), blank=True)

// serializers.py 
class ItemsSerializer(serializers.ModelSerializer):
 image = VersatileImageFieldSerializer(
sizes=[
 ('full_size', 'url'),
 ('thumbnail', 'thumbnail__100x100'),
 ('medium_square_crop', 'crop__400x400'),
 ('small_square_crop', 'crop__50x50')
]
)
 class Meta:
 model = Items
 fields = (
'title',
'image'
 )
- litzy_Kr commented on March 12th 20 at 08:11
image: - in this table I store just the name of a photo "name.jpg" - litzy_Kr commented on March 12th 20 at 08:14
@litzy_Kr Static and media stored on S3?
And which libraries are used for working with AWS and what are the value constants in DEFAULT_FILE_STORAGE settings.py? - kane1 commented on March 12th 20 at 08:17
March 12th 20 at 08:10
About django-stdimage
I understand that not only started the fact that was not retained in the database names for the preview? But they are in the database and are not needed everywhere then where you want - in templates, the vyuha - need to preview, easy to get through the specified alias
I'm want to record it to the database - litzy_Kr commented on March 12th 20 at 08:13
Don't see the point.
Look settings preview can change, you need 5 preview different - which is another 5 fields in the database to do? Make sense? - romaine7 commented on March 12th 20 at 08:16

Find more questions by tags Django