Jako / ImagePlus

Advanced Image Custom TV in MODX Revolution
https://jako.github.io/ImagePlus/
GNU General Public License v2.0
29 stars 20 forks source link

Not working with MODX 3 alpha-3 #91

Closed SnowCreative closed 3 years ago

SnowCreative commented 3 years ago

Tested version: 2.13.0-rc1

On MODX 3 version: Nightly from 2021-03-01

When setting up a TV, I selected the input type Image+, but then when going to the Output Options, selecting Image+ there generated a popup error: Requested processor not found. I switched the Output Type back to Default and was able to continue. Assigning the TV to a template worked.

When loading a page with this TV assigned though, I could go not further; a large block of errors appeared in the editing window. Leaving the Target Width and Height blank instead of entering values made no difference.

Here’s the block of errors:

TypeError: Argument 3 passed to ImagePlus::prepareTvValue() must be an instance of modTemplateVar or null, instance of MODX\Revolution\mysql\modTemplateVar given, called in /home/rainbowt/modx3/core/components/imageplus/elements/tv/input/imageplus.class.php on line 94

Errors:

ImagePlus->prepareTvValue(string “”, Array ( [targetWidth] => 300 [targetHeight] => 200 [targetRatio] => [thumbnailWidth] => [allowAltTag] => 1 [allowCaption] => [allowCredits] => [allowBlank] => 1 ) , object) ImagePlusInputRender->process(string “”, Array ( [targetWidth] => 300 [targetHeight] => 200 [targetRatio] => [thumbnailWidth] => [allowAltTag] => 1 [allowCaption] => [allowCredits] => [allowBlank] => 1 ) ) MODX\Revolution\modTemplateVarRender->render(string “”, Array ( [targetWidth] => 300 [targetHeight] => 200 [targetRatio] => [thumbnailWidth] => [allowAltTag] => 1 [allowCaption] => [allowCredits] => [allowBlank] => 1 ) ) MODX\Revolution\modTemplateVarInputRender->render(string “”, Array ( [targetWidth] => 300 [targetHeight] => 200 [targetRatio] => [thumbnailWidth] => [allowAltTag] => true [allowCaption] => false [allowCredits] => false [allowBlank] => 1 ) ) MODX\Revolution\modTemplateVar->getRender(Array ( [targetWidth] => 300 [targetHeight] => 200 [targetRatio] => [thumbnailWidth] => [allowAltTag] => true [allowCaption] => false [allowCredits] => false [allowBlank] => 1 ) , string “”, Array ( [0] => /home/rainbowt/modx3/core/src/Revolution/Processors/Element/TemplateVar/Renders/mgr/input/ [36] => /home/rainbowt/modx3/core/components/migx/elements/tv/input/ [45] => /home/rainbowt/modx3/core/components/imageplus/elements/tv/input/ ) , string “input”, integer “68”, string “imageplus”) MODX\Revolution\modTemplateVar->renderInput(object, Array ( [value] => ) ) ResourceManagerController->loadTVs(Array ( ) ) ResourceUpdateManagerController->process(Array ( [a] => resource/update [id] => 68 ) ) MODX\Revolution\modManagerController->render() MODX\Revolution\modManagerResponse->outputContent(Array ( ) ) MODX\Revolution\modManagerRequest->prepareResponse() MODX\Revolution\modManagerRequest->handleRequest()

Jako commented 3 years ago

Could you try to chage that line to

public function prepareTvValue($json, $opts = array(), $tv = null)
SnowCreative commented 3 years ago

I replaced line 242 of "core/components/imageplus/imageplus.class.php" with your suggestion. That fixes the issue with inputting the TV info and cropping in the associated resource.

Also, some other errors cropped up, which were fixed by deleting "modTemplateVar" from the "function" line (as you did above) in these other places:

core/components/imageplus/imageplus.class.php line 212 now says "public function getImageURL($json, $opts = array(), $tv = null)"

core/components/imageplus/model/cropengines/PhpThumbOf.php line 50 now says "public function getImageUrl($json, $opts = array(), $tv = null)"

After making these changes, the [[ImagePlus]] snippet works better in that it doesn't crash the web page, but now there is this error on the page: Image+ Error: Invalid Media Source

Media source is set correctly for the TV, and the correct thumbnail shows up in the Resource after assigning the image to the TV. This line: $source = $this->modx->getObject('modMediaSource', $data->sourceImg->source); is returning an empty value. (line 73 of "core/components/imageplus/model/cropengines/PhpThumbOf.php")

BUT . . . I still get the "Requested processor not found" popup error when trying to edit the TV. The popup error appears when I first load the TV to edit it. Then I can edit most things, but trying to assign an output chunk to the Output Options generates the error again, and no dropdown list appears.

Jako commented 3 years ago

I don't have that requested processor not found issue on my installation. But the media source does not work for me too.

Which PHP version do you use?

Jako commented 3 years ago

Image+ 2.8.3 is now compatible with 3.

SnowCreative commented 3 years ago

Yes, media source is working, and the image gets displayed properly on the front end.

So, no idea what "requested processor not found" could be about? It only happens for an Image+ TV, and seems to have to do with the selection of an output chunk. PHP is 7.2.34.

Jako commented 3 years ago

The requested processor not found is caused by a capitalization issue in the combo action. I hope it can be fixed without a version check.

SnowCreative commented 3 years ago

Ah. I wish I need what processor it was looking for. There are no detailed errors anywhere in the logs.

Jako commented 3 years ago

It is the chunk/getlist processor.

Neoziox commented 2 years ago

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.

Jako commented 2 years ago

Please open a new issue for this and don't reuse a closed old one.

Neoziox commented 2 years ago

Oh, I'm very sorry. I do right now.