Skip to content

using width_field and height_field cause remote storage loads to be unbearably slow #169

@qosha1

Description

@qosha1

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/',
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions