TheFive / osmbc

Open Street Map Blog Collector
MIT License
28 stars 11 forks source link

Broken preview image - NaN in wp-caption if not set #976

Closed call-me-matt closed 1 year ago

call-me-matt commented 1 year ago

If the title picture does not have dimensions set, the export sets width to NaNpx for wp-caption:

<!-- place picture here -->
<div class="wp-caption alignnone" style="width: NaNpx;">

This results in a broken preview image when our post is shared on social networks.

Proposed solution: determine image width or set a standard value instead.

TheFive commented 1 year ago

does that happen on all pictures ? or do you have an article, where it happens.

I think i have to follow the full path from adding the picture until the last html generation.

all necessary modules should be used (size detection of images, Markdown plugin with size...) but at the end the values "has get lost".

btw. if i start this topic, what is the exact need for this with. should i use an exakt high, an exact with, no high and with as the images are resized before upload (that was don 5+years in the past).

call-me-matt commented 1 year ago

Normally we set the lead picture in OSMBC as follows: ![lead picture](https://weeklyosm.eu/wp-content/uploads/2023/03/661_T_all.png =997x537). But if we forget to add the size for some reason (it has happened several times in the past) and only set ![lead picture](https://weeklyosm.eu/wp-content/uploads/2023/03/661_T_all.png), then this error occurs.

And the result is, that when sharing the link on social media, the preview image is not shown but the favicon or simply a white image.

I believe there is no record of a weekly with this bug, because we always correct manually once we notice - but there is a pull request to our notification script to verify this doesn't happen again.

TheFive commented 1 year ago

See PR #977