How to create a simple Image Gallery content element?

Hi,

I’m checking to implement a simple “Image Gallery” content element. I have checked https://github.com/daniellienert/DL.Gallery and it looks promising.

Would there also be some other solution?

My idea is to simply create a custom content element and then to provide a list of image asset objects with a specific tag via TypoScript to the html template. With this no additional PHP code would be needed.

Thanks for feedback.

1 Like

Hey @olibur,
currently it is not possible to access the media repository and select media by tags using TypoScript and without using PHP. Thats one of the reasons, I used the ViewHelper approach. Another suitable way would be to build an eelHelper that is capable of selecting media by tags.
Once we have an advanced meta data management for assets available, there will be a comfortable way to select assets via TypoScript.

Cheers,
Daniel

ah oke, thanks for the background info. Are the assets stored as nodes too or aren’t they? So theoretically we could query somehow “Give me all nodes below /media/collectionXY with given property tag”? Or are the assets somehow handled differently than normal content nodes?

The assets are stored in a different table structure as the nodes and thus handled differently.

Ah ok, thanks for your info!

Hi @daniellienert,
I’ve got some questions to your Gallery plugin.

I want to adapt the configuration, so I have added the following to my /Packages/Sites/MY_SITE/Configuration/Settings.yaml:

DL:
  Gallery:

    loadGalleryCSS: true
    loadGalleryJS: true

    themes:
      bootstrapLightbox:
        label: 'Bootstrap with Lightbox'
        themeSettings:
          columnClass: 'col-md-2'
          imageVariants:
            thumb:
              maximumWidth:
              maximumHeight:
              width: 200
              height: 200
              allowCropping: true
              allowUpScaling:

I’ve changed the columnClass and the thumbnail sizes.

But somehow this config is not loaded, it still uses the default ones. Do I need to move the config to the root Configuration folder?

Then as far as I have seen the thumbails get generated in the Web/_Resources/Persistent/… folder. How can I easily remove unused image thumbs if I delete a Gallery from a page? Or is this done automatically? Or do I need to do this manually in the filesystem?

Thanks for your help

Check the indentation of the YAML (looks wrong in your post) and make sure your package is loaded after the gallery package (by adding a dependency from your package to the other).

Thanks @kdambekalns for your response.

I have corrected the YAML indentation in my post above, but in my code it was already ok.

Where do I need to add this dependency? In the composer.json of my site package?

What I still have found out:
If I create a Settings.yaml file in the “Development” folder, it works. So the config in the file /Packages/Sites/MY_SITE/Configuration/Settings.yaml does not work, but in /Packages/Sites/MY_SITE/Configuration/Development/Settings.yaml it works. How is this possible?

I have also flushed the cache to be sure after changing the Settings.yaml.

Thanks for further help.

Yes, exactly. Flow uses this information to find out about the order in which packages need to be loaded.

ok thanks.

I have tried to add it, the require section of my composer.json looks like this now:

"require": {
    "typo3/neos": "*",
    "typo3/neos-nodetypes": "*",
    "dl/gallery": "^0.2.0"
}

I have flushed then all the caches, but it does not yet work. It still loads the default Gallery settings. But as already stated in my last comment: If I add the configs to the Settings.yaml stored below Configuration/Development then it works. But it should actually also work if its just stored in Configuration/Settings.yaml right?

If you add a Settings.yaml in Configuration/Development, this takes precedence of all Settings.yaml in just Configuration of all Packages and the base distribution.

The settings on the same level - eg all settings directly in Configuration are overwritten in the order of the package dependency. Therefore you need to add the dependency to the gallery package in your site packages composer.json.

Here

“require”: {
“dl/gallery”: “*”
}

would be enough. If this isn’t working. Try to remove the file Configuration/PackageStates.php which is then generated according to the new dependency.

1 Like

that was it, adding the Gallery dependency to my site package, deleting the PackageStates.php and let it rebuild again solved the Configuration issue.

Thanks a lot!