Skip to content

Wrong width and height #24

@pinpointconseil

Description

@pinpointconseil

I don't now if I'm doing wrong.
Here is the model settings:

image_picture_width = models.PositiveIntegerField(default=266)
image_picture_height = models.PositiveIntegerField(default=150)
image = PictureField(verbose_name = _("Category Image"), upload_to='tag_images', blank=True, width_field="image_picture_width", height_field="image_picture_height", aspect_ratios=[None, None, None, "16/9"])

In my template:

                {% picture tag.image alt="tag_image" m=2 l=2 style="max-height: 98px;object-fit: cover;" width="266" height="150" %}

I uploaded the image, but image_picture_width and image_picture_height were overridden (800px, 600px)

In Chrome inspector got this:

<picture>
  <source type="image/webp" srcset="/_pictures/tag_image/3x2/800w.WEBP 800w, /_pictures/tag_image/3x2/100w.WEBP 100w, /_pictures/tag_image/3x2/200w.WEBP 200w, /_pictures/tag_image/3x2/300w.WEBP 300w, /_pictures/tag_image/3x2/400w.WEBP 400w, /_pictures/tag_image/3x2/500w.WEBP 500w, /_pictures/tag_image/3x2/600w.WEBP 600w, /_pictures/tag_image/3x2/700w.WEBP 700w" sizes="(min-width: 0px) and (max-width: 991px) 100vw, (min-width: 992px) and (max-width: 1199px) 16vw, 200px">
  <img src="https://trivaty-dev.s3.amazonaws.com/media/tag_images/languages.jpg" alt="tag_image" style="max-height: 98px;object-fit: cover;" width="800" height="600">
</picture>

why the image width are not set correctly? how to fix that?

Thank your to clarify as no information are available in the docs.

Metadata

Metadata

Labels

documentationImprovements or additions to documentation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions