Skip to content
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

Image width and height are undefined #134

Closed
iwap opened this issue Feb 16, 2024 · 1 comment
Closed

Image width and height are undefined #134

iwap opened this issue Feb 16, 2024 · 1 comment

Comments

@iwap
Copy link

iwap commented Feb 16, 2024

Describe the bug

The width and height attribute of images is undefined:

<img src=\"<src-path>\" alt=\"<alt-text>\" srcset=\"<src-set>\" sizes=\"100vw\" width=\"undefined\" height=\"undefined\">

To Reproduce
Steps to reproduce the behavior:

  1. Add an image from the media library into the CKEditor
  2. Save the entity
  3. Look at the API response

Expected behavior

Receive the width and height of the image in the API response

@iwap
Copy link
Author

iwap commented Feb 16, 2024

I've also tried using the other CKEditor plugin: https://github.com/ckeditor/strapi-plugin-ckeditor/, however I prefer this one as it allows a lot more customisation.
The other plugin sends undefined as well if you just add the image, however once you change alignment of the image it start reporting the width and height properties. This plugin still reports undefined if you change alignment or resize the image however (it does report a resize %). Perhaps this helps to find the issue (or if this plugin relies on some of their code you could pass on an issue report to them).
Having the width and height attributes available would be useful to be able to optimise the images when using them in a NextJS setup (parsing the html and loading the images into a <Image> component).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant