Gallery Import from Folder

This is my proposal for faster Gallery/Slider creation (and bringing similar functionality to that of BC’s galleries).

My aim is to keep within the Gallery/Slider, and overall Treepl, current functionality as much as possible.

After creating your Gallery ‘group’ as normal, there is an additional import option in the ‘slides’ list view labelled “Import from Folder” and once clicked it gave the option to select or create a folder on the server (probably just bring up the File Manager).
After selecting the folder the system basically constructs an import file in the background using all the detected ‘image’ files (.jpg, .gif, .png, etc…) in the chosen folder and “imports” it to create all the items into the gallery group (item names could be generated from the file name or just “Slide 1, Slide 2, etc…”).
These can then be further edited individually as normal.

Additional images can simply be added from other folders using the same process, or you can manually add/edit/remove ones as well.

For updating a folder of images - say you add 10 more images to a previously imported folder - you could simply import the same folder but the system has created item IDs based on files existence on the server (perhaps based on date added or some other system identifier) so re-adding previously added images again wouldn’t affect anything (just like any current .xls import with items having the same IDs).

This idea of “importing” from a directory of files could also be extended to other modules and possibly other file types like documents for a ‘Media Download’ module (.pdf, .doc, .xls, etc…).

Open to other peoples ideas/thoughts on this and if that sort of process is possible from the Treepl side of things.

1 Like

Following this one.
Will let it sit for a while to see if there are more ideas/thoughts for this :slight_smile:

Soon I will add it to the Public Backlog.
Sounds good to me :slight_smile:

Yep, happy to let it stew for a while and get other’s input/ideas.

Added here - If anybody has something they want to add, just let me know :slight_smile:

Hello All,

I hope everyone is doing well! I’m curious if anyone else is running into concerns about the lack of ability to import a full folder/file of images to create a gallery/slider? It’s great that the Adobe BC photo galleries can be imported in, but the process as I understand it now for new galleries on Treepl CMS is that you have one of two options for new Galleries and Sliders:

  1. Create each individual image in a gallery or slider group one-by-one via the admin, or
  2. Teach a client how to use an FTP platform and how/where to upload a file or folder of images and then create a spreadsheet and import the spreadsheet into the admin, which seems a bit clunky and I difficult to translate the full process to a client who just simply wants to upload a folder of images to show in a gallery.

My questions are:

  1. Is anyone else running into concerns or having to source a different platform for this reason?
  2. Has anyone found a better way or viable workaround that would make the process easier for clients?

Unfortunately this missing feature is a deal breaker for three sites that I need to migrate off of Adobe BC and one that is currently in design/development stages as a new site. All four sites rely heavily on a client’s ability to showcase several photo galleries. In fact, one client has just over 200 galleries - each with somewhere between 5 and 40 photos a piece and they add about 2 to 3 galleries per week, so the spreadsheet import and file upload process would get very tedious very quickly. As a reminder, there is a backlog item on this feature. I hate to be selfish if I’m the only one experiencing concerns with migrations and new sites without this feature available, but if you’re running into similar issues/concerns, I’d love a few extra votes to get this one moved up the list:

Thank you as always!

  • Ryan

Hi Ryan (@StudioRTP)

If I where you I would definitely look into the File Api, you would relatively simple be able to build a great gallery module with this tool. The client would simply use the file manager to add files to folder (drag and drop). I think that is the way to go with galleries for now.

VERY simple test for this, is something like

{% component type:"api", resource:"File System", folder:"/images/", collectionVariable:"images" %}

{% for item in images.items -%}

<img src="{{item.url}}">

{% endfor -%}

Would that be something you can work with? :slight_smile:

Hello @Peter-Schmidt!

Thank you so much for contributing here! I don’t have a lot of experience working with the API on Treepl CMS, but I can sort of follow what you’re suggesting here and definitely think this is worth a shot to see if I can get it to work. I’m mid-design/development on a project that is going to rely very heavily on photo galleries and the ability to easily continue adding photo galleries on a very regular basis (several a week). Right now we’re working on the site’s design and I had intended on developing in Treepl (with the help of Treepl’s dev team), but got concerned when I found out about the limitations on the Galleries and Sliders module. Your post here is giving me some confidence that not all hope is lost and I may still be able to remain on the platform for this project (which is great because the only alternative I could think of in this case was Wordpress - yuck!). I am going to create a trial site and see if I can implement the recommendation you’re proposing here to get a workable solution in place. If I can get it to work and it’s easy for my client to use, there is no question I’ll be building the site on Treepl. Also, if I can get this to work (with my limited API experience), I will post a link with results and any notes here so that others can learn and/or see a working example. I’ll even record a video as sort of a ‘how-to’ to share the results.

Thank you again @Peter-Schmidt! There is nothing more unsettling than proposing a CMS solution and then having to back out due to a missing feature that I didn’t expect. This is definitely not a complaint against Treepl CMS - I’m very happy with the work that they are all doing and the results that they are showing. It’s just a learning curve for both the partners and Treepl CMS to see what is missing and/or what can add a lot of value to the platform. The partner community has always been incredibly helpful, so I appreciate the input from you and the others and hope I can contribute more as I continue to learn the platform and come up with alternative ways of accomplishing different functionalities across the platform.

Thank you again!

Hi @StudioRTP

I am sure you can get it to work. There is not much to this part of the API since it is nothing more than what I have already published. The {% component type:"api", resource:"File System", folder:"/images/", collectionVariable:"images" %} will put all of the images from the folder in the collection “images” and from there it is all Liquid. Let me know if you have any problems, I will try and help you. I can’t see why you can’t get it to work.

When it is all set up I would think that the workflow for your client would be something like.

  • Add a folder name to a Custom Module, lets call it “gallery1”.
  • Add the folder itself in the file manager again called “gallery1”.
  • Drag and drop all the images (in one go) into the folder.

That should be it. The most critical part will be to be sure that the name in the custom module is unique and exactly the name same as the folder created in the file manager.

Then I would do something like this in the detail view of the custom module.

{% component type:"api", resource:"File System", folder:"{{}}", collectionVariable:"images" %}
Where {{}} is the field where they put the folder name. That could be another field if you want to.

And then the for loop with your gallery code in, like in the SIMPLE example:

{% for item in images.items -%}
<img src="{{item.url}}">
{% endfor -%}

  • Should be totally doable :slight_smile: :+1:

Hi again @StudioRTP

Just made a small test on our sandbox site, works fine - Let me know if you want to see it for “inspiration”. Maybe we can do a skype call or something where I can show it to you. Just let me know :slight_smile:

– Just send a message on Slack and we will figure it out :+1:

Awesome - thank you @Peter-Schmidt! I will take a look at this and test it myself. If I have any questions, I may take you up on your offer. I really appreciate the time and the testing, not to mention your offer to do a Skype and share info. I will play around with this over the weekend and let you know if I run into any trouble or could use a hand.

Thank you again Peter - really appreciate it!

  • Ryan

Hi @StudioRTP - Hope you got this working, I did a small video of the test I did.

@James - I think you mentioned this as well, if not, i’m sorry that I tagged you in this :slight_smile:

@Peter-Schmidt - I can’t thank you enough for this video. This solution will do exactly what I need it to do, which brings this project back to the Treepl platform. I know your time is valuable and you’re busy with your own work/clients, but I really appreciate the help here. For some reason I hear API and I just assume it’s way over my head. Thank you again for posting this - I think a lot of people are going to benefit from this video and instruction.

NW @StudioRTP - Just glad I could help. And it is always fun to try and solve these problems. Most of the time things are more simple than you think, all it takes is somebody pointing you in the right direction. I have tried being stuck so many times, at the point of saying; “It can’t be done” and then suddenly another partner og co-worker just says one word and it all falls in to place :slight_smile:

Yeah the API in this case is so simple and works just like a collection like we know, so as mentioned it is very simple but a VERY powerfull little piece of code. The gallery is one of the more obvious things we can use it for, but I am quite sure that there will be some awesome modules that will include the file API.