When my feet are off the road
Managing my images and stylesheets
The lockdown was still on and a boredom monster was clawing at the door, snorting and breathing it's threats to drive me stir crazy. With a hobby on hold, I needed something to keep me busy, when not out walking around for exercise.
My blog software all works fine, but a couple of things required updating to make life easier. Every now and then I would find something which needed attention or adjustment.
The image managmentThere were occasions that I would not use all the imagery which had been uploaded for a post. They sat in the image folder and increased as time went by. To get rid of them involved going through the posts offline and deleting the unused ones, then wiping the entire online folder of it's images and uploading the adjusted folder full. My admin does have a screen where I can delete online photo's one at a time, no problem, but I needed something better.
As usual checking around various forums was a total waste of time. Most of them found some tutorial websites, copied the code and pasted it into the forum.
A dropdown was already in place. All I did was move the form tags above and below the whole thing and replace the individual forms with checkboxes. I can choose one or as many images as I like, in any order and click the Delete button.
The Delete button calls up a tiny script (the top code) which grabs the "dI" sub routine from my library file. The code in the sub routine which does the deletion, to handle the rest. All of the images whose checkbox was clicked are passed through the Use 'CGI qw(:standard);' during the grab. The first line, in the sub routine, is the param call which puts them all into a foreach loop. While (another loop) I'm there each image is deleted. A lot of them can take several seconds, but that's a ton better than the close onto an hour and subsequent FTP work which I used to put up with.
My StylesheetsOnce in a while I want to alter a color or style for a specific view. To do that I had to play around with the stylesheet off line and then upload it to the server.
Editing the CSS online was simple. All I needed to do was go through the directory with the CSS files in, list them, apply a radio button for each, click one radio button and the file was opened in a minimal plain text editor. Once there any editing could be done on my domain's server in a few seconds.
All of the above only added 2k to my base install and it is still under 160k. Also, I trimmed down a few other bits of code and lowered the basic size even more.
Aug 04, 2020