-
Notifications
You must be signed in to change notification settings - Fork 91
Description
I'm not sure if this is an issue as much as just something i wanted to note for others using this.
I recently finally debugged an issue that took my site from a ~1s load time to 12-14s (good number of photos per page). Apparently when you load the width/height from the VersatileImageField to a model field and have the images on remote storage (im using amazon S3), it takes forever to load.
I ended up removing the height/width fields from the model and then just used the image.height / image.width method.
This suggested code in the docs was the culprit:
class ImageExampleModel(models.Model):
name = models.CharField(
'Name',
max_length=80
)
image = models.ImageField(
'Image',
upload_to='images/testimagemodel/',
width_field='width',
height_field='height'
)
height = models.PositiveIntegerField(
'Image Height',
blank=True,
null=True
)
width = models.PositiveIntegerField(
'Image Width',
blank=True,
null=True
)
Instead I used:
class ImageExampleModel(models.Model):
name = models.CharField(
'Name',
max_length=80
)
image = models.ImageField(
'Image',
upload_to='images/testimagemodel/',
)