MozillaFoundation / foundation.mozilla.org

Mozilla Foundation website
https://foundation.mozilla.org
Mozilla Public License 2.0
384 stars 153 forks source link

Update article_double_image_block to use dynamic images #6921

Open danielfmiranda opened 3 years ago

danielfmiranda commented 3 years ago

Wagtail Docs on dynamic images for reference: https://docs.wagtail.io/en/stable/advanced_topics/images/image_serve_view.html

Currently, article_double_image_block is rendering images like so:

          <div class="col-sm-6">

            {% image self.image_1 fill-445x324 as img1 %}
            <figure class="my-default">
              <img src="{{ img1.url }}" alt="{{ img1.alt }}" class="w-100" />
              {% if self.image_1_caption %}
                <figcaption>
                  {{ self.image_1_caption|richtext|remove_wrapping|safe }}
                </figcaption>
              {% endif %}
            </figure>

          </div>

However, we can probably optimize image loading by using wagtail dynamic images, referenced above.

┆Issue is synchronized with this Jira Task

Pomax commented 2 years ago

@danielfmiranda is this still an open task?

danielfmiranda commented 2 years ago

Hi @Pomax! It appears that it is, after looking into it though, it appears that the work needed is not to implement the dynamic image URL setup as described in the linked documentation above, as Kalob has set that up for us in "images_url_tag_urls.py", but instead to update the {% image %} tag to use the new format he describes in the comments of the file.

For example: {% image product.image fill-250x250 %}

should now be: {% image_url product.image 'fill-250x250' %}

I will update this ticket shortly to reflect the work that needs to be done!