craftcms / craftcms/cms

Image Editor Not Loading (possible Edge only bug)

Open
#18,985 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

What happened?
Description

When editing an image in the Image Editor, the image never fully loads. The preloader just spins infinitely.

Only spotted on Microsoft Edge - full stack and summary below (note that these errors appear as soon as the image editor loads not when trying to save - saving just throws an empty body error):

Image

JavaScript Error Log - Asset Image Editor

Error 1: Image Height Method Not Found

Type: TypeError
Message: e.image.getHeight is not a function
Location: AssetImageEditor.js:322:42
Stack Trace:

at AssetImageEditor.js:322:42
at app-vendor.js:2:250218
at HTMLImageElement.o (app-vendor.js:2:56273)

Error 2: Cannot Read 'removeAllListeners' Property

Type: TypeError
Message: Cannot read properties of undefined (reading 'removeAllListeners')
Location: AssetImageEditor.js:1946:31
Stack Trace:

at Object.hide (AssetImageEditor.js:1946:31)
at Object.e [as hide] (Base.js:76:36)
at Object.<anonymous> (Base.js:162:23)
at HTMLButtonElement.o (jquery.js?v=1779958211:2:86401)
at HTMLButtonElement.dispatch (jquery.js?v=1779958211:2:39853)
at Object.trigger (jquery.js?v=1779958211:2:69839)

Error 3: HTTP Request Failure

Type: HTTP Error
Status Code: 400 Bad Request
Endpoint: POST https://xxxxxxxx.com/admin/actions/assets/save-image
Method: saveImage() in AssetImageEditor.js:1775
Stack Trace:

xhr @ axios.js?v=1779958211:2
kt @ axios.js?v=1779958211:2
value @ axios.js?v=1779958211:2
sendActionRequest @ Craft.js:831
saveImage @ AssetImageEditor.js:1775

Error 4: Cannot Read 'width' Property

Type: TypeError
Message: Cannot read properties of null (reading 'width')
Location: AssetImageEditor.js:515:67
Triggered By: Window resize event → _repositionEditorElements()
Stack Trace:

at Object._repositionEditorElements (AssetImageEditor.js:515:67)
at Object.updateSizeAndPosition (AssetImageEditor.js:464:14)
at Object._handleWindowResize (Modal.js:371:14)
at Object.<anonymous> (Base.js:162:23)
Steps to reproduce
  1. Double click on an image
  2. Click Edit Image to open the image editor
Expected behavior

Image should load in the image editor

Actual behavior

Image partially loads with the preloader, but never fully finishes loading.

Craft CMS version

5.9.9

PHP version

8.2

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

"born05/craft-sentry": "3.0.0",
"clubstudioltd/craft-asset-rev": "8.0.0",
"craftcms/aws-s3": "2.2.4",
"craftcms/ckeditor": "4.11.0",
"craftcms/cms": "5.9.9",
"craftcms/element-api": "4.2.0",
"craftcms/feed-me": "6.11.0",
"craftcms/mailgun": "3.1.0",
"craftcms/store-hours": "4.2.0",
"ether/simplemap": "5.0.4",
"jalendport/craft-preparse": "3.0.0-alpha.2",
"mailchimp/marketing": "^3.0",
"nystudio107/craft-cookies": "5.0.0",
"nystudio107/craft-minify": "5.0.0",
"nystudio107/craft-retour": "5.0.14",
"nystudio107/craft-seomatic": "5.1.20",
"putyourlightson/craft-sprig": "3.7.1",
"servd/craft-asset-storage": "4.2.3",
"solspace/craft-freeform": "5.14.14",
"spicyweb/craft-odds-and-ends": "5.1.0",
"studioespresso/craft-dumper": "5.0.1",
"studioespresso/craft-scout": "5.0.7",
"verbb/hyper": "2.3.1",
"verbb/navigation": "3.0.17",
"verbb/super-table": "4.0.5",

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in Microsoft Edge by opening an asset and selecting Edit Image, then inspect AssetImageEditor.js at the reported getHeight, hide, saveImage(), and _repositionEditorElements() locations. Use the logged errors and the save-image request as the starting points. Done means the image finishes loading, resizing and closing do not raise errors, and saving no longer returns an empty 400 response.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.