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

Error when cropping an image #231

Open
matiasb7 opened this issue Mar 26, 2024 · 9 comments
Open

Error when cropping an image #231

matiasb7 opened this issue Mar 26, 2024 · 9 comments

Comments

@matiasb7
Copy link

I upload the image, then try to crop it with your tool and i get an error where:
image
It doesn't happend everytime, but with one image, 80% of the time happens and i don't know why.
Image is:
soldier-test-3

Steps to reproduce the behavior:

  1. Upload an image
  2. Click on crop image
  3. Select the area to crop
  4. Click on Crop Image
  5. All looks ok, except for the current thumbnail image at the top right corner where it looks like 404. (First Image uploaded )

Expected behavior
I expected to work and crop the image

Screenshots
image

Server (please complete the following information)

  • Operating System ubuntu
  • PHP Version 8.2.15
  • Using PHP-FPM? no
  • Using WordPress Cron? yes

How did you install the plugin?
Wordpress

@jawngee
Copy link
Contributor

jawngee commented Mar 26, 2024 via email

@jawngee
Copy link
Contributor

jawngee commented Mar 26, 2024

Working fine here.

Screenshot of Opera at Mar 26, 2024 at 10_59_46 PM

@matiasb7
Copy link
Author

Storage provider : amazon s3
imgix: Yes
Free version
version: 4.6.2

For debugging:
[26-Mar-2024 16:01:29 UTC] PHP Warning: Trying to access array offset on value of type bool in /var/www/html/wp-content/plugins/ilab-media-tools/classes/Tools/Crop/CropTool.php on line 265
only that in the server

And in the web console, i get sometimes:
ilab-media-tools.js?ver=4.6.2:1 Uncaught TypeError: Cannot read properties of undefined (reading 'get')
at window.ILabCrop. (ilab-media-tools.js?ver=4.6.2:1:5781)
at c (jquery.min.js?ver=3.7.1:2:25304)
at Object.fireWith [as resolveWith] (jquery.min.js?ver=3.7.1:2:26053)
at l (jquery.min.js?ver=3.7.1:2:77782)
at XMLHttpRequest. (jquery.min.js?ver=3.7.1:2:80265)

@jawngee
Copy link
Contributor

jawngee commented Mar 26, 2024

Open up CropTool.php and change the line (line #204) in the function displayCropUI() from:

$meta = wp_get_attachment_metadata($image_id);

To:

$meta = wp_get_attachment_metadata($image_id);
if (!is_array($meta)) {
	Logger::error("{$image_id} doesn't have metadata.");
	return;
}

Save the file and try the crop again. Check the debug log (WordPress Admin -> Media Cloud -> Debug Log) after and look for "doesn't have metadata" in the log. Let me know if it's there.

@matiasb7
Copy link
Author

Now i didn't get that error. So i enable the info log and here are the logs from when i click to crop the image, after it finishes.
media-cloud-log (1).csv
I don't see any errors, but the result is:
image

@jawngee
Copy link
Contributor

jawngee commented Mar 26, 2024 via email

@matiasb7
Copy link
Author

Yes I'm using imgix, where can i disable the image optimization? is that from this plugin? Because i don't see any other plugin for that, unless I'm overseeing something.

@jawngee
Copy link
Contributor

jawngee commented Mar 26, 2024 via email

@matiasb7
Copy link
Author

matiasb7 commented Mar 26, 2024

First of all, thanks for your help!
I've been trying to debug it and understand the issue without reaching anything.
if you want and can, we can make a quick call. Sorry for the inconvenience.
Also, something to add is , the system returns an url for the image, but that url returns 404. So i don't know if it's a problem from imgix.

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

2 participants