Quantcast
Channel: Little Singing Hills
Viewing all articles
Browse latest Browse all 22

Photo Links Fixed, Some Small Projects, and a Newly Re-Paved Road

$
0
0

I finally got around to fixing the photo links that had been broken in the process of restoring my weblogs after I found my server had been hacked.

Although blogging software can be used to create photo galleries, it’s not really ideal for the task, so I’ve always used photo gallery software in conjunction with my weblog software.

At the time my server was compromised, I was using WordPress weblog software in conjunction with an older version of Gallery (version 2) photo gallery software.  In order to place the image links from the photo gallery into my blog entries, I was using a plugin (WPG2) that converted the actual image links to the ID numbers of the photos (the conversion from the ID numbers to the actual image links took place quietly and effectively behind the scenes).

Using that plugin, in my blog entries (before the translation) the photo links were neat, short entries like this: <wpg2>1142</wpg2>.

After my server was hacked my older photo gallery software became suspect (primarily because I found some garbage entries in the photo database like “‘Gallery Error’, ‘malicious url’, ‘Error (ERROR_BAD_PARAMETER) : malicious url <b>in</b> modules/core/DownloadItem.inc <b>at line</b> 98 (GalleryCoreApi::error)…”), so I decided it was time to upgrade to the newest version.  I had put off upgrading in large part previously because I didn’t relish the thought of losing any of the 1600+ photos I had in my photo gallery.

So I installed the latest version of the photo gallery software (version 3) on my server.  Fortunately it had a function to import an older Version 2 gallery and that conversion went without a hitch.

But I found that the WordPress plugin that displayed the links no longer worked with the new photo gallery version.  That meant that the blog software was unable to translate the image ID numbers for the photos into URLs/links, effectively preventing any of the photos embedded in my blog entries from displaying at all.

I searched for another plugin that would duplicate the functionality of the original plugin with the latest version of the photo gallery software to no avail.

As there was no way that the plugin would allow me to revert back to URLs/links I found myself with no other option than trying to translate the old embedded image entries myself, or simply leaving the photo links broken.  As the latter was unacceptable, I formulated a plan to do the translations.

I opted to write  a computer program that would use an exported SQL database file from the photo gallery and from it generate a list of image ID numbers and corresponding URLs/links.  After I did that, I could replace the blog entry image IDs with the proper URLs.

It would have been pretty straightforward if the database had included the list of image IDs and URLs.  But the database files weren’t set up so that I could do that translation directly.

There was a list of images with image IDs in the database, but that list didn’t include the directories (folders) that the images were in.  That information was contained in the database in a different “child”, “parent” paired list that determined the relationship of folders to folders and images to folders that I needed to perform recursion on to create complete URLs for each image.

Once I created the list of image IDs and URLs I simply had to process an exported WordPress blog database file, replacing the image IDs with the URLs I had created.

My program chugged away for some time replacing the old image links with the new ones, but the only way to test the result was to import the data back into my blog software, replacing the old data, and see if the photo thumbnails and links were back.

I backed up the current existing database prior to attempts to restore it with my modified version.  Since the WordPress import function is intended to restore a database into a new/blank installation, I had to experiment with clearing some of the database tables manually to get the import to work properly in my case.

For a moment I thought I found a bug in my conversion when I noticed a few photo links hadn’t been restored until I realized that I had lost some photos (they were no longer in the photo gallery and didn’t have entries in the photo gallery database) so my conversion hadn’t translated links for them at all.  It might have occurred when the site was hacked or during one of my moves from one hosting service to another, but fortunately it was only a small number of photos lost.

Otherwise in spite of having broken a few things in the initial import, I was happy to find my photo link restoration attempt had worked!  It took a few tries and data restores before I was able to complete the process without any other adverse effects to the blog.

However, in the process of re-importing the new WordPress data I inadvertently triggered email notifications of all my blog entries to anyone subscribed, sending 80+ email notifications (my sincere apologies to those I spammed).  I guess I’ll consider that the broken eggs in my omelette making…

I was thinking of posting the conversion program when I was done with it in the off chance some other poor sap had made the same choices I had and was trying to restore photo links.  But now that I’ve completed my conversion I’m not inclined to do more work on the program and I just don’t think it’s refined and/or user-friendly enough for release, and I suspect most others have long since moved on if they had experienced this problem.

Shortly after I rebuilt my photo gallery and blog I had searched for a similar replacement plugin to use with my blog software and the new photo gallery, but after my conversion project decided it was best if I just stuck to straight URLs/links instead of using a new/different proprietary conversion scheme/plugin.

That decision was made easier since I couldn’t find a plugin that worked properly and did what I wanted to do anyway.

So to create the links in the future, I wrote another small program that will extract an image URL from my photo gallery and create a properly formatted thumbnail and image link for insertion into my blog entries.

And because I’m now using real URLs/links instead of replacement/virtual links, in the future should my photo gallery move, I will be able to update the images in my blog by simply searching and replacing the root part of the photo gallery URL, instead of having to parse and translate the photo gallery database as well.

All’s well that ends well, but lesson learned.  Proprietary anything is often bad in the long term when it comes to computers.

Last weekend I worked on a few smaller projects on the new building that I had also been putting off.

The first was fixing my shop ceiling heater exhaust venting.  When I installed the venting I ran it to beyond the bottom of the roof soffits above (I didn’t want exhaust running back into the soffits).  But this placement meant when it rained hard that rainwater running off the roof entered the cap vent holes and ran back down through the venting.

I had long ago formulated a plan to fix this problem; it was just a question of getting onto the ladder to actually do it.  I removed the vent cap, cut an aluminum strip that covered the top 1/3 of the holes on the cap, riveted it onto the cap and then re-installed it.

I also had to disassemble part of the radiant boiler venting in order to install a siding mounting block as trim.  (This little project took a lot longer than I would have preferred.)

Here are the before and after photos:

During these projects I did discover the culprit for the holes in the window screens I mentioned in the last entry.  It is indeed the work of grasshoppers, and I found a big one munching on the screen and captured him in the act.

I don’t know why grasshoppers would want to eat fiberglass screens, but this one did some serious damage, eating a sizable hole in the short time that I watched him. After he chewed open the hole, he climbed through it and sat on the inside of the screen.

I subsequently replaced the screen and sprayed it with bug repellent to see if that would dissuade them from eating it again.  I suspect that in order for the repellent to work I’ll have to keep re-applying it now and again.

Finally, the nearest paved road to our house is being resurfaced, meaning we have to take an alternate route to get to and from the house.

I went out to take photos of the work, and in the few minutes it took to do that saw numerous vehicles driving on what was clearly marked as a closed road. (You can see two cars up the road in the second photo below.)

 

I guess some people simply think signs like “Road Closed” just don’t apply to them.  I can only hope that when they got further north they got stuck in the construction zone…

I’ve also transitioned to using my Samsung Galaxy Nexus Android smartphone for many of the photos I take for my blog. I used to use my Canon Rebel XT for most of my photos around home, but since I carry my phone with me most of the time it’s much more convenient to just use the camera on my phone.

It’s notable because the Nexus has been faulted for only having a 5 MP camera on it – exactly the same resolution as on my previous smartphone (a Motorola Droid).  But I was never happy enough with the quality of the photos from my Droid to use it except in a pinch.  On the other hand, the photos from my Nexus are more than adequate for my purposes.

It does go to show that image quality isn’t just about megapixels.

Last week I was amused to read the blog of some friends (Dave and Nancy) to find that Nancy spent some time working at the Dakota County Fair, and when she first arrived saw and took a photo of what she called a runaway pig.  It turns out the pig she had happened upon was Kim’s pot bellied pig, Quentin.

Quentin isn’t a barnyard animal – he’s an inside pet so it’s likely that his week at the Children’s Barnyard at the Fair is a trying experience for him.  You can see some photos of Quentin at the county Fair last year here.


Viewing all articles
Browse latest Browse all 22

Trending Articles