A Gallery, My Kingdom for a Gallery!
I meant to write another post in the All Things Art and Good series today since I have received permission from a lot of wonderful artists whose amazing creations I’m eager to share with the blogosphere However, I had this little WordPress plugin/coding entry that I had to make since it has some relevance to the art posts.
When I wanted to start writing about artists and their work, I wanted to liven up the posts with some images. Instead of providing links which led in all directions and which people might not be interested in following, I wanted to provide some visual cue as to all the wonder and beauty they might find in my own post. A thumbnail gallery of images seemed the best way to do this.
Unfortunately, I couldn’t find a single gallery plugin for WordPress which did what I wanted There were WordPress gallery plugins aplenty which either provided a gallery provided the images were on your own server or on a remote Gallery2 installation or on a remote image sharing service like Flickr. But what if I didn’t want to download somebodyelse’s copyrighted material and put it up on my own server? (That somehow felt a little icky to me …) What if all I wanted was a simple gallery of images mentioned in each post that provided a thumbnail image at the end of the post and linked back to the original image? There just didn’t seem to be such a beast …
So, I decided to code my own. In fact, I spent most of the day before I wrote the first All Things Art and Good entry in coding up the plugin At the moment, the plugin simply takes a list of image links in a post as long as they follow a specific format, remove the image links from the post and instead creates a gallery of these images at the end of the post. The plugin will automatically create a thumbnail version of the original image on my server the very first time. After that, the cached thumbnail is used for the gallery each and every time.
I originally created the gallery to follow a rigid grid pattern based on a certain number of columns. This worked fine except that the nitpicky side of me couldn’t abide the fact that when you resized the browser window, sometimes you might have a lot of empty space because you went with a low number of columns So I went for a more fluid gallery which would adjust its layout as the browser window was resized. Unfortunately, this dynamic layout results in some rather strange layout issues. However, I’m going with it for the moment.
Of course, there’s another issue. When I wrote the plugin, I was testing things with the entry I did on Ruben de Vela. Now all of Ruben’s images were direct links to a specific image file. So my method of extracting info from an IMG tag and linking back to the original image worked fine. But when I got to Phil McDarby, I realized that I had a problem – Phil had pages for each image and these pages were full of other images and links which would provide a lot more information to a fan of his work. But my thumbnails were linking directly to the main image only, not to the HTML page!
Of course, I mention the pages in my post and link to them directly as well so as to get around this but I’d rather have the thumbnails themselves link to the proper page. I’ll probably have to modify the way the plugin works to do that though. So I’m thinking about how I’m going to do that at the moment. If you’ve got some solutions to the issues I’m facing, or have been looking for a similar plugin and would like to get the plugin from me, let me know. But tomorrow, we get back to our regularly scheduled program and look at the beautiful and funny artwork of Denis Zilber