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 downsize happening in editor content when lazyload is disabled #704

Open
abaicus opened this issue Oct 6, 2023 · 0 comments
Open
Labels
bug This label could be used to identify issues that are caused by a defect in the product.

Comments

@abaicus
Copy link
Contributor

abaicus commented Oct 6, 2023

Description

It seems that right now, when we disable the Scale images & Lazy load option, changing image sizes in the editor returns the optimized URL to the content, which shouldn't happen - the sizes get filtered by the image_downsize filter here.

I think it would be enough to add the following condition at the top of the method the filter uses:

if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
	return $image;
}

@Codeinwp/optimole Let me know if you see any issues with this approach.

Step-by-step reproduction instructions

  1. Disable the Scale images & Lazy load;
  2. Insert an image in the editor (its URL is the original one - as it should be);
  3. Change the image size in the editor sidebar;
  4. The image URL will be the optimized one, saving it to the content, which shouldn't happen;
  5. You can check the URLs by switching to the code editor in Gutenberg or simply inspecting the editor contents;

Screenshots, screen recording, code snippet or Help Scout ticket

image

Environment info

No response

Is the issue you are reporting a regression

No

@abaicus abaicus added the bug This label could be used to identify issues that are caused by a defect in the product. label Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This label could be used to identify issues that are caused by a defect in the product.
Projects
None yet
Development

No branches or pull requests

1 participant