# Atributo srcset pode carregar imagens maiores no mobile do que no desktop

**URL:** <https://meta.discourse.org/t/srcset-attribute-may-load-larger-images-on-mobile-than-desktop/264039>\
**Category:** UX\
**Tags:** mobile\
**Created:** [Maio 6, 2023, 3:12am UTC](https://meta.discourse.org/t/srcset-attribute-may-load-larger-images-on-mobile-than-desktop/264039 "2023-05-06T03:12:51Z")\
**Posts on this page:** 1\
**Showing post:** 28

<div class="post-metadata">

**Author:** ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)\
**Post date:** [Julho 20, 2023, 8:24pm UTC](https://meta.discourse.org/t/srcset-attribute-may-load-larger-images-on-mobile-than-desktop/264039/28 "2023-07-20T20:24:58Z")

</div>

Uma correção mais geral para todos os oneboxes foi criada:

> <https://github.com/discourse/discourse/pull/22621>
>
> In an effort to preserve bandwidth especially for mobile devices this
> change wil…l prevent upscaled srcset attributes from being added to
> onebox thumbnail images.
> 
> Besides checking the html for onebox classes, our database structure for
> uploads does not distinguish between regular images and onebox thumbnail
> images, but all upload images in discourse do have a thumbnail. By
> default this thumbnail is what is used for the non-upscaled image for
> onebox images, so we should only use that thumbnail. Because the
> rendered onebox image size is likely smaller than the upload thumbnail
> size there really shouldn't be a need to upscale.

Para testes, usei artigos deste site não-wikimedia: [Read the latest Great Reads stories from car lovers like you - Hagerty Media](https://www.hagerty.com/media/category/great-reads/) pois eles tinham imagens razoavelmente grandes para onebox.

Antes:

 ![image](https://global.discourse-cdn.com/meta/original/4X/e/e/3/ee3951e2af93be96545ef5fc1e774358117206c1.jpeg)

Depois:

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/6/7/a67533b2d777bed63b70f58f66e7c7d5fa26d3e2.jpeg)

Antes desta alteração, as imagens do onebox tinham cerca de 400kb. Após a minha alteração, elas têm cerca de 100kb.

 ![image](https://global.discourse-cdn.com/meta/original/4X/6/e/7/6e792aa730624badcb420aff8a689e59cdb57a0a.jpeg)

Aqui está um exemplo de onebox que está usando o tamanho de miniatura reduzido  
[https://www.hagerty.com/media/car-profiles/driving-the-prodrive-p25-brought-out-my-inner-car-crazy-kid/](https://www.hagerty.com/media/car-profiles/driving-the-prodrive-p25-brought-out-my-inner-car-crazy-kid/)

---

_[View the full topic](https://meta.discourse.org/t/srcset-attribute-may-load-larger-images-on-mobile-than-desktop/264039)._
