There when in editor I add image and change only width but leave height empty there not put value for me with calculation. It support to be.
For example my image size is 1000x500. So I put in image width 200 and leave height empty and when click save button there mast be made calculation for height and save that value except situations when user pet height value by hand. The same for width if only value in height input.

CommentFileSizeAuthor
#2 2014-03-24_1146.png174.06 KBCodenator
#2 2014-03-24_1146_001.png31.67 KBCodenator
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Codenator’s picture

Codenator’s picture

FileSize
31.67 KB
174.06 KB
Codenator’s picture

Title: Image size not chage automatically » Image size not chage automatically CKEditor
tim.plunkett’s picture

Priority: Major » Normal

I think this is just a bug. Nice find!

Wim Leers’s picture

Title: Image size not chage automatically CKEditor » Image size not changed automatically in CKEditor
Status: Active » Postponed
Issue tags: +CKEditor in core
Related issues: +#2039163: Update CKEditor library to 4.4

Thanks for filing this issue and taking the time to record a screencast!

Before I work on this though, #2039163: Update CKEditor library to 4.4 must be committed, because that might affect the solution, since it comes with a big improvement in the code handling images inside CKEditor. Once that lands, I will look into this again :)

MarkusDBX’s picture

I investigated this bug today. After the update to CKEditor 4.4 was fixed.

There is still no automatic height calculation being done, it's just an empty value.
So when using only width to scale images, only the width-attribute is forwarded to source. This fixes the issue with the too heigh images.

However... when using only height, and not width to scale the images. Resulting in images getting only the height attribute in source. Nothing happens in the frontend theme, but it's correctly scaled in ckeditor. This might confuse users.

The reason to this is many themes just overrides the image height with css, like this:
img{height: auto;}

So I guess the height/width auto calculation is still needed, because otherwise scaling by height will not work, since it's seem to be depending on the width attribute.

Question: Is the user supposed to be able to only enter the height attribute on images? (Since it will not work today with most themes by default, nothing will happen).

Wim Leers’s picture

Status: Postponed » Active
MarkusDBX’s picture

Assigned: Unassigned » MarkusDBX
Wim Leers’s picture

We removed the width/height settings in the image dialog. Hence we indirectly solved this issue.

There still is the image resizing drag handle, which does work correctly. In 8.1 we should have #2061377: [drupalImage] Optionally apply image style to images uploaded in CKEditor 5, which will make all of these problems definitely a thing of the past.