Bruno17 / MIGX

MIGX for revo 2.2 and above
83 stars 78 forks source link

migxResourceMediaPath creates empty folders #406

Closed dishly closed 1 year ago

dishly commented 1 year ago

I needed to upload multiple files in Migx to create galleries. I followed this official Modx tutorial step by step:

https://docs.modx.com/3.x/en/extras/migx/migx.tutorials/use-resource-specific-mediasource-and-multifile-uploader

Everything works fine, the only issue is that now every time I click on any TV in the manager an empty directory is created (under “assets/resourceimages/”) named with exactly the same ID as the TV I clicked.

It looks like the snippet migxResourceMediaPath (from the Media Source “ResourceMediaPath”) gets executed every time I click on a Template, TV or Chunk in the “Elements” tab of the manager.

I changed &createFolder to 0 but its not an ideal solution if you wish to dynamically create a folder for each Migx gallery.

Bruno17 commented 1 year ago

whats your environment? Versions of MODX, PHP ...

dishly commented 1 year ago
Bruno17 commented 1 year ago

this should be fixed now. Directories should only be created, when you are in resouce/update Could you please try to replace the snippet with this new code? https://github.com/Bruno17/MIGX/blob/master/core/components/migx/elements/snippets/migxresourcemediapath.snippet.php

you can now also restrict directory-creation to resources which specific TVs by adding

&checkTVs=`yourmigxtv`

to the snippet-call

dishly commented 1 year ago

Great news, thank you Bruno. Will this be included in a new Migx release at some point?

Bruno17 commented 1 year ago

will be included with the next release