Wrong crop with Image+

Summary

First, I have a minimal size on my TV parameter. But, whatever I choose as an image, it always tells me that the image is too small (parameter: 2000 × 500, I choose an image 4000 × 1000, but it’s too small for him). So, I deleted the minimal sizes.

But now, when I choose an image, this one is automatically cropped but in a wrong way (a tiny zone of the image). If I crop manually, it’s still bad cropping. I don’t know how can I fix this.

I post this issue in the Github #110 but I still have no response unfortunatly

Environment

MODX 3.0.1, Image+ 2.8.9

Can you be more specific so that I can at least try to replicate the problem.

  • What are the exact “Input Options” of your TV?
  • What are the exact “Output Options”?
  • What do you mean by “it’s still bad cropping”?
  • How exactly do you output the TV in your template/content?
  • What Crop Engine (pThumb, phpThumbOf, phpThumbsUp or phpThumbOn) do you use?

Input Options

Only Target Aspect Ratio (4) and Thumbnail Width (250)

Output Options

Default

“ it’s still bad cropping ”

It’s better if I show you:


In the Image Editor, you have the expected result, and, above, you have the disappointing result.

Output and Crop Engine

I don’t need to look the output result, I already have it in the Manager. By the way, I have the same result of course.
Good question for “Crop Engine”. Do you really need it to understand my issue given that the problem already exists in the Manager? To be honest, I don’t know. I made the site a long time ago.

Ok, I can reproduce the problem.

It only happens when you initially select the image file though.
When you open the crop window a second time, the crop values are correct.

I suspect the scale factor (of the image in the crop window) is not taken into account, the first time the crop window shows.

Sorry. Even if I open several times the same image, I always have this wrong cropping. Several times the crop editor modal windows, but always the problem. I deleted the ratio aspect, but I still have the same issue :slightly_frowning_face:

If you select an image, then click “Close” in the “Image+ Editor” window and then open the editor again (middle button in the picture below) to set the crop, does this not work?

imageplus


I tried to debug the problem (but it is quite hard with a minified js file).

The variable displayRatio in the editor is set wrong for larger pictures (> 600px) after selecting the picture.

I think there is some code in the function manualGetImageSize to account for this, but that doesn’t seem to work the way it should.

It was a timing issue. The img.onload did not set the right image sizes in a reasonable time for larger images. It is now solved with having an ‘else’ in Update to 2.9.0 · Jako/ImagePlus@634f330 · GitHub

3 Likes

I guess I’m in a good way, thanks to you. But I have another issue, how can I solved this conflict?

Because, it’s doesn’t work right now.
Of course, I cannot uninstall the 2.8.9 version.

You can edit the transport_packages database table and change the package_name value to Image+ for the 2.9.0 version.

It should also be possible to replace just the imageplus.min.js file for a test.

I edited the transport_packages database table and I changed the package_name value to Image+ and it works.

But, for the cropping issue… same :slightly_frowning_face:

I inspected the sources to verify that it was the correct version of imageplus.min.js: it is the correct one (2.9.0)

I chose a 799px image and, indeed, it does crop nicely.

Can you send me the TV configuration and the image, that shows the issue? I am very busy tomorrow, so I can look for this on friday.

Strictly simple.

Image: In fact, every image :grimacing:

@jako OK for friday, thanks a lot

I am working on it. It is a bit more complicated on the second view, but the cropping issue exists and it exists only on MODX3.

2 Likes

Thanks @jako for thinking about this issue

It is solved with 2.9.1 fixing a lot of ancient code parts.

1 Like

I have the same problem and while waiting for the udate with the fix, @halftrainedharry 's solution to open the cropbox again is exactly the workaround I’m using as well.

2.9.1 is available, in case you did not tested that.

2 Likes