Gallery without images that are included in textarea?

Hi there!
I want to make a gallery that features all images that are not already included in a textarea field.

Panel editors can upload files to a specific page and optionally can include them into a textarea field, which then renders the html into the template.
But then I want to create a gallery that includes all the images, that are not already included and rendered within the textarea.
So I get the textarea (text with images) and the gallery (list of images), but have no files displayed twice.
How would I do that?

– Go through the plain text of the textarea and check if there are any images, remember them and exclude them from the gallery loop?
– Or is there an existing method on file() to check if it is used within a specific field?
– Let the editors manually create the gallery using an additional textarea
– Any other ideas?

Thanks a lot!

If you really want to do that, you’d indeed have to go through the textarea field and grab all the image file names that may or not be in there. Don’t think I would do that. However, if you do this on panel.page.update and store the used images in a separate field, that might work without costing too much performance.

The best idea is to use an image gallery field where users can select the images to use in the gallery, for example the Kirby Images field. I think that is better suited than a textarea field.