Devious Malcontent

 Blog Blog RSS

Resurrecting the gallery | SBX needs pagination | Adding SPGE to the mix.

Monday 22nd April 2024

What a convoluted title.

SBX = Simple-Blog-XML

SPGE = Simple-Photo-Gallery-EXIF

Pretty much what it says on the tin.

Back when I started this site because I didn't know how easy it was to integrate WordPress into a website, I decided I'd roll my own blogging software, I did try a few open-source alternatives, but this actually seemed to work in my favour in the end, the other solutions were just too complicated.

Fast forward a few years and I've gotten a fair bit more experience in web development, I had an image gallery for a student body website, but there ain't no way I'm gonna build an individual page for each of these photographs, so being the programmer dude that I am, I hacked together a simple gallery layout page in PHP, that would read the EXIF data from a photo, that way if people wanted a description for it or caption, they would simply have to fill out the comment section in windows image viewer, upload it via ftp and the server would do the rest.

When I eventually got around to fully documenting the development work I was doing for one of my many various game development projects, I use this same "framework" for that website, that can be found here: https://30stormstudios.com/games/relicofsin/gallery.php

The moral of the story is the simplest a solution is usually the best!

So, when I was running this site as a cringey teenager, I had a section called gallery where I believe I was going to stick my videos and photos of cool projects that I did, in reality it was just shit. - being that young I didn't know what I was doing, but tonight I decided to resurrect the gallery after killing it back in 2012 during the great website restructure and re-theming of that year, the year that I became known as devious malcontent on the web. (AKA Mr hackerman, leet coder, 10X developer) - yeah, I've learnt to embrace the cringe.

I decided to resurrect it, because I missed it, I'll do it for historical purposes but as this site progresses in its life span, I intend to add more meaningful content to it on top of the drudgery of shit that I posted back in 2009? When I started this charade.

Resurrecting the gallery!

I was hoping this would be easy, but I simply pulled down the latest version of Simple-Photo-Gallery-EXIF, after digging out the old pictures from my old site archive, I used a command line tool called ExifTool by Phil Harvey, written in Perl, (because Windows does its own fuckery to the user comments field), using the old site archive as a reference, I added the missing meta data to each image, ideally, it would be, or it should have been as simple as sticking these images in a directory, and letting the PHP app do the rest on the server, but I found some bugs with the script, that make it, not as user friendly as I first thought, or promised, so I need to do better!

I really need to sit down and spend some time with this PHP app to improve its stability and refactor some of the code as it's difficult to read. - Especially some of the exception handling aspects of it.

But that will have to come later.

So for now, I have now turned the main gallery page into a sort of index page for a few sub galleries, for the pictures that I have resurrected, I stuck them on the classic gallery page, and I have plans to bring a bit of my content back online, such as adding a gallery for all the birds that I have photographed over the years, I may also add a blog gallery for all of the photos that I take, but this is a good start.

Pagination for Simple-Blog-XML

I've noticed a degrade in the performance for loading the blog index page, it wasn't an issue when there were only 30 entries, but now there is over 80, and I did a dumb thing when I first wrote code for this page, it rewrites\updates the RSS feed, every, single, time, the page loads, resulting in a significant slowdown. Ah, the shit I did as a teenager. Lol ex dee. Etc. - already, removing that block of code speeds up load time significantly, and it doesn't need to be called every time the page loads, so my hack for this, for the moment, is to simply query the number of blog entries and compare the count in the RSS feed, if it's less than the total number of files, then it is time to update.

The next issue, I thought to myself, many years ago, reading\parsing XML is, or at least it should be a relatively straight forward process, but I've had time dealing with it in C, and let me tell you, like fuck it ain't. worst is that my XML files aren't compliant, or valid with the spec, to fix this back in the day I sidestepped the issue and just parsed every single blog file using a preg match technique, to extract just the title and date, as that's all I needed for the index. - but alas That comes with the performance trade-off, so I spent some time trying to parse the XML files, and eventually settled on reusing my old code, but this time caching it. oh boy, so I think Simple-Blog-XML Needs to undergo a little bit of a design change and refactor before I merge these changes into it.

Mind you, it has also been about 8 years since I last worked in PHP, or at least on this code base and I've learned a lot since then. - we also have PhpStorm now, Laravel and MacBooks. *I actually did make use of Dev-PHP version 2.0 for this project, and I have learned not to neglect tooling, and embrace debuggers.

So now with that cashing, the performances tenfold and adding the pagination code is relatively easy, I basically just stole what was in Simple-Photo-Gallery-EXIF and used that, but there's room for improvement.

I'm happy to admit that I need to do better and sometimes it's not a bad thing to eat your own dog food.

Updating the links page

Finally, on my original website, there was a section called Good Programs/Software for Windows, while not ready for this update, I am in the process of bringing this section back! - it's an awesome snapshot from back in the day (circa 2009), but part of the problem with bringing back this section is that I need to stay on top of it, that is to say some of the software that I have recommended in the past has changed in quality over the years, less about providing a cool free app and more about harvesting your data, so while this section I wanna bring back, there's still a little bit of work to go through to make sure what I'm recommending is ethical, and most likely open-source.


Home | Blog Index | RSS