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

The X coordinate plus the width must not be greater than 1 #13

Open
2 of 4 tasks
fritzmg opened this issue Nov 12, 2020 · 3 comments
Open
2 of 4 tasks

The X coordinate plus the width must not be greater than 1 #13

fritzmg opened this issue Nov 12, 2020 · 3 comments

Comments

@fritzmg
Copy link
Member

fritzmg commented Nov 12, 2020

Error message

Internal Server Error: The X coordinate plus the width must not be greater than 1

Versions

  • Contao: 4.8+ after an update from 4.4
  • PHP: irrelevant
  • Browser: irrelevant

Location

  • Backend
  • Frontend
  • Contao Manager
  • Composer

Link to forum thread

https://community.contao.org/de/showthread.php?75740-Dateiverwaltung-funktioniert-nach-Update-auf-Contao-4-8-nicht-mehr

@fritzmg
Copy link
Member Author

fritzmg commented Nov 12, 2020

Cause

Starting with Contao 4.8 (or may be one or two minor versions sooner) Contao is storing the important part of images in a relative format, i.e. with floating point numbers between 0 and 1, instead of absolute numbers in integers, representing the amount of pixels in either direction of the image dimensions.

Therefore a migration is done to convert the existing absolute integer values to relative float values. However, this migration might fail for individual images under certain circumstances, some of which are still unknown.

One instance where it might happen: if you have defined the important part of an image in Contao 4.4 and then replaced the image with a smaller version in Contao 4.4 (either via SFTP or via the back end), the important part info isn't automatically updated and thus might already contain invalid values. The important part values of this image then cannot be transformed into the new format any more.

There are also reports of instances where this always happens with SVG images when updating from 4.4 to 4.9 for example.

@fritzmg
Copy link
Member Author

fritzmg commented Nov 12, 2020

Workaround

In order to find the images in Contao 4.9+ with invalid important parts, you can use the following SQL query:

SELECT * FROM tl_files WHERE importantPartX + importantPartWidth > 1 OR importantPartY + importantPartHeight > 1;

This allows you to keep a note of the affected images somewhere, so that you can reset the important part now and afterwards define the important part again in the back end. Use the following SQL query to reset the important part on the affected images:

UPDATE tl_files SET importantPartX = 0, importantPartY = 0, importantPartWidth = 0, importantPartHeight = 0 WHERE importantPartX + importantPartWidth > 1 OR importantPartY + importantPartHeight > 1;

@fritzmg
Copy link
Member Author

fritzmg commented Jul 30, 2021

This should not be an issue any more. See contao/contao#2884

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