Amazon S3 + More Gallery

Hi there,

I have a few questions about integrating Amazon S3 as a media source into MODX to use in conjunction with MoreGallery.

For one, I would like it so the paths for the thumbs (and any other crop generated photo) that is normally stored within modx, to be stored in my Amazon S3. There seems to be very little documentation that covers this, and only is briefly mentioned saying that it is possible.

The link to my amazon s3 bucket is as follows: https://s3.amazonaws.com/randykrugerphotography-2017/

How would I go about linking that to MoreGallery.

Also is it possible to have the import button within MoreGallery select more than one photo in the modx resource browser. Currently, I can only select a single photo, which is very time consuming for a large gallery.

Hi Kolby,

As MoreGallery works through the media sources API, if you configure your media sources correctly to use Amazon S3, that will work with MoreGallery. I think there’s a few small features that only work with the filesystem, but nothing major that should be getting in your way.

Step 1 is to get your media source working in MODX. The MODX documentation on that is sparse, but it’s basically a matter of entering the right credentials into the media source configuration.

For an AWS bucket in Ireland (EU-WEST-1 region), I used this information:

  • url: https://name-of-bucket.s3.amazonaws.com/
  • bucket: name-of-bucket
  • key: my AWS key, this is managed I believe in the IAM section of the AWS dashboard. This authentication also needs access to S3.
  • secret_key: the associated secret key (password)
  • region (create this property, if it doesn’t exist): eu-west-1.

The exact information will depend on your bucket location and login. Test it against the files tree, before moving to use it in MoreGallery.

Once you know it works in the file tree, then you can tell MoreGallery to use it. This is done with the system settings by going to System > System Settings in your manager, and choosing moregallery in the dropdown that defaults to core. There, under the Storage, you’ll find the settings moregallery.source and moregallery.source_relative_url. Set the first one to your S3 media source, and the second to the path within the bucket where you would like to store the media.

That should do the trick.

At the moment the MODX browser does not support multiple selection, so we’re not able of adding multiple imports at once at the moment. You can upload multiple images at the same time, that might be a quicker way to get all images added.

Hi Mark,

Thank you soo much! This worked perfectly!

Have you had any experience in using Amazon S3 to store photos. It seems that when it is a media source in modx, that any photos over 100 tend to timeout, and not load at all. This happens in the media source tree as well as in the resource browser when importing.

Maybe I just have too many photos…

I don’t actively use S3 at the moment, but the media source is indeed quite slow because it has to talk to the S3 API all the time.

There’s a newer S3 media source available as an extra that is supposedly better (newer API) and possibly faster, so might be worth trying that one. Seems to be actively developed. I haven’t used that myself yet, but a package can be found on github: https://github.com/modxcms/aws-s3-media-source/tree/master/_packages