Using resource-specific mediasource and multifile-uploader with MIGX
Last updated Jan 24th, 2023 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$290 per month—let's make that $500!
Learn moreUse resource-specific media source and multifile-uploader¶
In this Tutorial we will learn how we can have a dynamic media source, with its own auto-created file-folder for each resource. For uploading multiple files at once, we will use MODX's multiupload - dialog. All uploaded files will be auto-added as items to the MIGX - grid. Removing Items will remove the image-file.
Requirements¶
First off we will need to install MIGX by Package Management.
Create the dynamic resource-specific media source¶
- Go to: Tools->Media Sources
- Create new media source
- name: ResourceMediaPath
- source type: Filesystem
- Update this media source
- basepath and baseurl:
You may also need to create a directory with write-permissions for php: assets/resourceimages/
Create the MIGX - TV¶
Create a new TV
- Tab: General Information
- name: resourcealbum
- Tab: Input Options
- Input Type: migx
- Configurations: resourcealbum
- Tab: Template Access
- select your Template for your album-resources
- Tab: Media Sources
- select the ResourceMediaPath - media source for your context (web by default)
Create the Configuration for the MIGX-TV¶
- Go to: Components->MIGX->Tab: MIGX
- Create a new Configuration with 'add item'
- name: resourcealbum
- Click 'Done' to save the new Configuration
- right-click on the new configuration and select 'import/export'
- copy/paste this code into the textarea:
Have Fun¶
Now you should be able to create Album-Resources, upload images with multifile-uploader and synchronize the MIGX-items with your files. For listing them on Front-end use the getImageList - snippet like that:
or if you have more complicated tpl or you are using phpthumbof at the image with a tpl-chunk
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$290 per month—let's make that $500!
Learn more