-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown images (ThumbnailImage) have inconsistent sizing behaviour #6359
Markdown images (ThumbnailImage) have inconsistent sizing behaviour #6359
Comments
NoteFor the moment, we'll need to recommend that FEM project owners avoid using images in tables. (Slack) This will be the workaround while we consider a better fix. |
The 999px limitation is set by these rules, so edit these regexes to allow bigger thumbnails. You’ll probably need to edit the URL rewrites in that file too, to catch URLs with bigger numbers. EDIT: I've opened a PR to make that change. |
Markdown doesn’t have a syntax for specifying image sizes, so FEM looks for the height and width in the image alt text. Here’s the code that expects height and width to be in the alt text. front-end-monorepo/packages/lib-react-components/src/Markdownz/Markdownz.js Lines 33 to 39 in fef769f
EDIT: the storybook tests both PFE and FEM variations on markdown image sizing. |
This needs testing, but removing the 100% height and width from the image CSS fixes the teeny tiny Grommet Image. So removing Lines 63 to 68 in fef769f
|
#6360 looks like it will fix the tiny images in project About pages, after testing in Firefox and Chrome on Shaun's test project and WildWatch Burrowing Owl. I marked that PR as closing this issue, but feel free to amend that, as this issue is actually several different issues (across multiple GitHub repo's.) I’ve opened zooniverse/thumbnailer#27 to increase the maximum thumbnail size from 999px to 9999px. |
This doesn’t really solve the problem, because you get a low resolution, pixelated image. The subject images on the new home page are an example of images that look terrible because they are rendered larger than their natural size (#6333.) The new code makes a deliberate design decision not to enlarge undersized images. If you want an 800px image on your About page, you have to upload a suitably sized image. Conversely, images also look terrible if you size a large image down in the browser eg. |
FWIW, the CSS that caused sub-issue 1 (tiny images) was pretty easy to find in the browser DOM inspector. The image component was styled to fit its container, but the container You can reproduce the same bug in PFE by adding https://master.pfe-preview.zooniverse.org/projects/darkeshard/test-project-2022/about/results |
Sorry, one other comment. The fixed size element in the DOM here is the |
Accessibility for people with disabilitiesWhen projects do use tables for layout in markdown, you should probably consider the layout on small screens, and the accessibility barriers for dyslexic or blind visitors too. As well as being an accessibility barrier for screen readers, which can enter table mode and read the table content as tabular data, layout tables don't allow for a responsive layout that adapts to screen size. |
Regarding sub-issue 2, which can't be fixed by a PR, here's a link to the documentation for the nginx image filter, which resizes the thumbnail images. It can shrink and sharpen an image, but it can't make it any bigger than it already is. https://nginx.org/en/docs/http/ngx_http_image_filter_module.html |
UI Bug
Package: lib-react-components
Components: Media > ThumbnailImage, possibly Markdownz itself
Noted as of: fef769f
Images in Markdown (e.g. as used in a Project's About page) can have inconsistent sizing behaviour. To be specific:
Analysis
Analysis of Sub-Issue 1: the chicken-and-egg hypothesis
<img src="example.jpg" width="800"
, it goes<img src="thumbnails.zooniverse.org/800x/example.jpg"
) (Note: the image does have a max-width FWIW)<td>
)<table>
's columns will size itself depending on the size of its contentScreenshot: we see the same animal image in two different kinds of tables. In both cases, the table layout logic seems to determine the width of left & right columns by looking for "fixed content" first - in this case, the text in the right column. It then leaves the remaining space for the "flexible content", meaning the image just fills up whatever space is left.
Analysis of Sub-Issue 2 & 2a:
<img src="meerkat-206x183.jpg" width="800" />
Analysis of Sub-Issue 3:
Testing
To test this, simply try adding Markdown images with various explicit sizes (smaller than the original, larger than the original, etc) and in various situations (inside a table with a lot of other content, etc) to a test project's About page.
For example, heres my test project: https://www.zooniverse.org/lab/19242/about/results
And here's the Markdown code I used
Now, compare the rendered Markdown on both PFE and FEM codebases:
Status
Priority analysis and dev work assignment pending.
We know that, as of 3 Oct, this is affecting at least one project.
The text was updated successfully, but these errors were encountered: