# "wrong" image size on discourse topic

**URL:** https://meta.discourse.org/t/wrong-image-size-on-discourse-topic/91773
**Category:** WordPress
**Created:** [July 7, 2018, 12:17pm UTC](https://meta.discourse.org/t/wrong-image-size-on-discourse-topic/91773 "2018-07-07T12:17:17Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [July 7, 2018, 12:17pm UTC](https://meta.discourse.org/t/wrong-image-size-on-discourse-topic/91773/1 "2018-07-07T12:17:17Z")

</div>

Hi.  
There is an article on my website which contains images. On the site, they display well :  
([Auron au bord de l'insolation ! - Monocycle.info](https://monocycle.info/3ieme-edition-dauron-au-bord-de-linsolation/))

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/6/86226ed202f9107cd5a50563e4aa4c1be67f2f01.jpg)

On the WP edition page, they are blurry:

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/8/a896472915c5a300fb227cd60af08db683dc8ce5.jpg)

I guess this is because they have a custom size.  
For example, the last image (the table) original size is 1008px width.  
The custom size sets in the article is 500px.

I guess that when displaying the article on Wordpress, WP uses the closest larger size (here, 1008px), then decreases its width to fit in 500px because that’s the way to have the best quality.

However, on the editing page, it uses the WP auto-generated medium size: 300px, and increases its width to be 500px, hence the blurry aspect.

The thing that bothers me is that this is this blurry version which is posted on Discourse by [WP Discourse](https://github.com/discourse/wp-discourse),  
([Auron au bord de l'insolation ! - Monocycle.info](https://monocycle.info/3ieme-edition-dauron-au-bord-de-linsolation/))

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/7/578246e9b3df65e56c7f1adc74ae009d163a638e.jpg)

making images like this table unreadable.

Is there any way to tweak [WP Discourse](https://github.com/discourse/wp-discourse) so the published topics use the closest larger images instead of the closest smaller ones?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 7, 2018, 4:14pm UTC](https://meta.discourse.org/t/wrong-image-size-on-discourse-topic/91773/2 "2018-07-07T16:14:37Z")

</div>

The image size on WordPress is being set by the `srcset` attribute. The image that is published on Discourse is the image that is in the `src` attribute of the WordPress post. If you view the page source on WordPress (select ‘view source’, not ‘inspect element’ on your browser) you can see that this is the image that will be used by Discourse. It’s width will be set to 500px by the value of it’s `width` attribute, so it will be blurry.

 ![](https://global.discourse-cdn.com/meta/original/3X/6/c/6c2e873023c2b1427e5f12e60362ec1dc7bdc2ea.png) 

For images where the size is important, you could edit the image tag on WordPress so that a larger image is set in the `src` attribute.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [July 7, 2018, 4:27pm UTC](https://meta.discourse.org/t/wrong-image-size-on-discourse-topic/91773/3 "2018-07-07T16:27:51Z")

</div>

Hi,  
Thanks for this explanation.  
Thing is, we have several persons writing articles on the website, I can’t edit all the images tags manually, I need something automatic. Plus, if I do this it will load the large image on small screens on WP, right?

Is there a [WP Discourse](https://github.com/discourse/wp-discourse) function that I could filter to make it use the wp image srcset attribute instead?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 7, 2018, 7:44pm UTC](https://meta.discourse.org/t/wrong-image-size-on-discourse-topic/91773/4 "2018-07-07T19:44:31Z")

</div>

> [@Canapin](#):
>
> Plus, if I do this it will load the large image on small screens on WP, right?

You can test this. My understanding is that the value of the `src` attribute is only used if a browser doesn’t support `srcset`. If that’s the case, you should just ask your authors to select a larger image size when they add an image to a post.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [July 7, 2018, 9:02pm UTC](https://meta.discourse.org/t/wrong-image-size-on-discourse-topic/91773/5 "2018-07-07T21:02:23Z")

</div>

Hi,  
I guess I can tell them to always insert their images full size in their post, then resize, so the src url will be full-sized.

Thanks for your replies. 🙂

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [August 6, 2018, 9:02pm UTC](https://meta.discourse.org/t/wrong-image-size-on-discourse-topic/91773/6 "2018-08-06T21:02:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
