Hidden HTML elements to store data?

I built a photo gallery plugin for my Wordpress site, which uses the Lightgallery Javascript plugin.

I currently use another plugin to store the images in the database. This solution works fine, however it requires a paid plugin.

I’m wondering if it’s feasible to store the images as some element hidden in the markup, then use the Gallery plugin to parse the markup for the hidden elements, and add the images dynamically.

The benefit, as I see it, would be that users wouldn’t have to have a separate plugin to store the images in the database, rather, they could add the images to the_content() and let the Gallery plugin parse the markup and add them to the slider.

Is this feasible? What would the downsides be?

Even if you have the images listed in the html mark up they are still stored in a folder somewhere so what’s the difference with pointing to their actual location when required?

Most lightbox type galleries just change the image source to point to the larger image when required to avoid having all images loaded when not needed. If you wanted them all loaded at the start then you could just hide them with css and show them etc but that’s not how it’s usually done for a lightbox effect (small image shows a larger image).

If you just have static sized images and not too many of then then you can just list them in the html and have them shown in turn.

There are a lot of sliders around that will do this. Here’s a decent one.

Sorry, I didn’t point out my intention very well.

I currently use a Wordpress plugin to manage the image galleries for the posts. The plugin provides a nice UI to the post editor to add the images. Absent that, I don’t have a good way to add the images to the posts.

What I’d like to be able to do is add the images somewhere in the markup (or the_content() for Wordpress) so that the gallery plugin can parse them and build the gallery dynamically.

I could, of course, just add the images directly into the markup without “hiding” them, but if a post has several images, and not much text, that would look sort of weird.

Sorry I’ve moved the thread to the CMS/Wordpress forum as none of what you say really means anything to me as I do not do Wordpress :slight_smile:

Hopefully someone more familiar with Wordpress can chime in.

It doesn’t seem likely that you can change a Wordpress gallery plug-in very easily though.

1 Like