Install Error with migxFineUploader

Hello –

I’m attempting to install the migxFineUploader configuration and get the following error (error log):

[2021-12-10 10:28:39] (ERROR @ /Users/wesleypicotte/Sites/kurvup/core/xpdo/om/xpdoobject.class.php : 240) Error 42000 executing statement: 
    [0] => 42000
    [1] => 1055
    [2] => Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column '' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

This occurs on ModX 2.8.3, served locally with MAMP Pro. I’m using PHP 7.0.33 due to the use of Archivist on this project, which seems incompatible with later versions of PHP.

I mention this due to the nature of the error described above - not sure of its relevance.

Any ideas on why this error occurred and / or resolutions are appreciated.

I believe you could change the configuration of MySQL to make it work.
In the ini file under “sql-mode” try to remove “only_full_group_by”.

A better way is probably to locate the query in the code and change it.
So what action exactly are you performing when this error happens?

Following the instructions Bruno prepared here, the step that produces the error is the import of the migxfineuploader config within the MIGX CMP.

FWIW, made the configuration change to MySQL and no longer get the error, but the MIGX config still does not upload.

Maybe you can try this ‘solution’ from github.

Thanks for posting this - unfortunately, Still no configuration loaded or errors posted to the error log after the addition to the core config file.

Can you manually add new items?

If that works, create one with the name “mfu_images” and save it. Then right-click on it and choose “Export/Import” and copy this Json.

1 Like

I’ve tried to get this installed, but NewsPublisher loads a text field for the MIGX tv, rather than a file input.

Much of what follows isn’t specifically germane to this, but in the event that I’ve overlooked something basic, steps taken have been:

  • Created mediasource ‘npImages’, ID of 3, and edited basePath and baseURL to [[!migxResourceMediaPath? &createFolder=`1` &pathTpl=`assets/resourceimages/{id}/`]]
  • Manually added MIGX config ‘mfu-images’, added JSON provided above
    • Changed sourceIDs in mfu_images under formtabs → Edit the tab ‘image’ → Edit the field ‘image’
  • Created migx tv ‘images’ (assume this can be named anything, just followed Bruno’s steps here and here)
    • On the Input Options tab, added ‘images’ to Configurations field (also tried ‘mfu_images’)
    • changed media source to ‘npImages’ (also tried leaving as web)
    • gave access to the relevant template
  • added a writable directory at path assets/resourceimages
  • created a basic NP snippet call on a test resource:

In the mfu_images JSON are a handful of IDs; these match what I see in the CMP (config ID for mfu_images is 3, the field “image” ID is 3, sourceid for mgr and web contexts is 3).

Other instances of the NewsPublisher snippet on the site utilize a file-type TV called chartImg, which loads with with the correct field type if included in the above snippet call.

I do not see anything in the error log after trying to load the resource containing the above call, or submit the form.

This should be ‘mfu_images’ (the name of your config)

You don’t need to change that as the media source is defined in the config.

Are there any errors in the console of the browser’s developer tools?

When you look at the source of the Newspublisher page, can you see that fine-uploader.min.js gets loaded? Do you see the <script> tags with some additional JS-code (var uploader = new qq.FineUploader({ ... })?

Thanks for the clarification. I figured as much, but mentioned it since the field wasn’t loading with the form.

There was a possible conflict with other scripts loading with the template. Once those were removed, the file uploader loads with the NP form and I see the injected css / js.

There are a couple other issues / questions:

Initially, .map files were not at the path MIGX was using. That’s just an FYI, I guess. They were stored in a maps directory, but MIGX was using assets/components/…/css and /js.

Files uploaded with migxfineuploader are placed in assets/resourcefiles/{id}, not assets/resourceimages/{id}. The folder for the new resource is nested below /resourcefiles, and is not generated at all below /resourceimages.

A basic getImageList call doesn’t produce a complete src path. The path is accurate based on the media source basePath / baseURL, but lacks the top-level directory. I can edit the media source values to use [[++assets_url]], and can to include resourcefiles in place of resourceimages, but am curious as to why this occurs at all?

Lastly, only a single image is uploaded when I include multiple files via the MIGX input. Any thoughts on why this could be?

Thank you

The updated mediasource solves the front end issue, as you’d expect. I’m curious to know where resourcefiles comes from, however?

Only a single file is actually uploaded when batching images. The following errors are produced:

[2021-12-22 06:08:16] (ERROR in modProcessor::run @ /Users/wesleypicotte/Sites/kurvup/core/model/modx/modprocessor.class.php : 185) Flat file processor support, used for action web/getfiles with path /Users/wesleypicotte/Sites/kurvup/core/components/migxfineuploader/processors/web/getfiles.php, is deprecated since version 2.7.0. 
[2021-12-22 06:08:32] (ERROR in modProcessor::run @ /Users/wesleypicotte/Sites/kurvup/core/model/modx/modprocessor.class.php : 185) Flat file processor support, used for action web/upload with path /Users/wesleypicotte/Sites/kurvup/core/components/migxfineuploader/processors/web/upload.php, is deprecated since version 2.7.0. 
[2021-12-22 06:08:32] (ERROR in modProcessor::run @ /Users/wesleypicotte/Sites/kurvup/core/model/modx/modprocessor.class.php : 185) Flat file processor support, used for action web/upload with path /Users/wesleypicotte/Sites/kurvup/core/components/migxfineuploader/processors/web/upload.php, is deprecated since version 2.7.0. 
[2021-12-22 06:08:40] (ERROR @ /Users/wesleypicotte/Sites/kurvup/core/components/migxfineuploader/model/migxfineuploader/migxfineuploader.class.php : 674) PHP warning: Missing argument 2 for MigxFineUploader::rmkdir(), called in /Users/wesleypicotte/Sites/kurvup/core/components/migxfineuploader/model/migxfineuploader/migxfineuploader.class.php on line 622 and defined

The missing argument in the line referenced by the final error looks related to mismatch with the mediasource file path.

You can ignore the “Flat file processor” deprecation warnings.

The other warning you should be able to fix by changing these two lines. (Remove the second parameter $mode that is never used.)

function rmkdir($strPath) { //CHANGED!
	if (is_dir($strPath)) {
		return true;
	$pStrPath = dirname($strPath);
	if (!$this->rmkdir($pStrPath)) { //CHANGED!
		return false;
	return @mkdir($strPath);

When I test it, all image files are correctly uploaded to assets/components/migxfineuploader/cache/... but when I save the resource, only one image is then copied to assets/resourcefiles/... and saved in the MIGX tv.
Is this the same behaviour you see?

I believe the problem has something to do with the session variable $_SESSION['migxfineuploader'], but I wasn’t able to locate the error yet.

OK, thanks.

Yes, exactly as you describe.

This “error” is a weird one.

If I test it and add multiple images one by one (by clicking the “Upload” button and selecting only one image, then clicking the button again and selecting only one other image) then everything works ok.

If I however click the “Upload” button and select multiple images at once (or drag multiple images in together), then not all images get saved.

For each image it generates an XHR request that executes the “web/upload” processor. In the processor the information about the uploaded image is saved to the session ($_SESSION['migxfineuploader']). In MODx the sessions are stored in the database.

If 2 requests to the processor are generated at the same time, then it seems like the second request gets a session that is out-of-date. The first request updates $_SESSION, but the second request reads $_SESSION before the updates from the first request are properly saved.

I’m not sure how this can be fixed. If you can’t rely on the $_SESSION variable, then you have to temporarily store the information somewhere else and that could be quite challenging to implement.

When I set the system setting session_handler_class to blank (to use the standard PHP session management instead of ‘modSessionHandler’), then the upload of multiple images works correctly.

I don’t know what the ramifications of this change are for the rest of your site, but maybe you can try that.

Incredible. Thanks for tracking this down.