Here’s a technical article about Web design that probably won’t interest most readers, but it may help a few people with photo sites solve a tricky problem.
One day not long ago most of the pictures disappeared from the Father Pitt site, and from all the other sites in the Father Pitt empire. The most recent articles were fine, but articles from a year or more earlier were missing their pictures. What had happened?
The problem was a change at Wikimedia Commons. For many years, Father Pitt has donated his pictures to Wikimedia Commons so that anyone can find and use them. He then embedded the lower-resolution “thumbnails” generated by Commons on his own site and linked them to the full-resolution versions at Wikimedia Commons. This embedding was specifically allowed by Commons, so no one was being taken advantage of. It started as a way to save server space and bandwidth when the Father Pitt site was operating on servers with limited resources, but it seemed good to continue the practice. It was especially helpful when the site moved to its own domain, and the pictures were still there because their addresses had not changed.
It used to be that the width of a picture was specified in the URL of the picture. For example:
https://upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Carnegie_Free_Library%2C_Allegheny_Center%2C_2026-03-26-1.jpg/450px-Carnegie_Free_Library%2C_Allegheny_Center%2C_2026-03-26-1.jpg
would render a picture 450 pixels wide, which was one of the standard resolutions Commons offered below the picture on the picture page. If you changed that number to 483 or 529, you would get a picture exactly that number of pixels wide.
About a year ago, those standard resolutions changed. Oddly, the numbers on the page stayed the same, but now if you click on a link that says “450 × 600 pixels,” you actually get a picture that’s 500 × 667 pixels. It turns out that this was part of a campaign by some of the people who run the technical end of Commons to reduce the number of “thumbnail” sizes to a few arbitrary ones—a campaign of which it seems the designers of the Wikimedia Commons image pages were ignorant. It was much discussed in the fora where those technical types gather, but it caught everyone else by surprise, including people working on other Wikimedia projects, when the switch was flipped and most thumbnail sizes stopped working.
That was where all the pictures went. Well, what could we do about it? Literally thousands of articles were affected, and it was not reasonable to revise all of them one by one.
The answer old Pa Pitt came up with was a kluge. His site runs on WordPress, and there are WordPress plugins that will replace any arbitrary text just before it is rendered on the viewer’s screen. Since the width of the image is encoded in the URL, changing the URL to one of the standard widths would make the images appear again.
Just in case there were identical pixel measurements in any style sheets or other debris in the thousands of articles on the site, which is more than eighteen years old, all the rules Father Pitt wrote looked like this:
change jpg/450px to jpg/500px
That combination of characters would not appear anywhere else but a Wikimedia Commons image address.
It is possible to use regular expressions (jpg/...px) to change every image at once to the same dimensions, but Father Pitt, at least, did not figure out a way to make a universal substitution that would make the portrait-format pictures a different width from the landscape-format or square ones. So some images whose dimensions are irregular still have to be changed by hand, but this kluge took care of ninety-eight out of a hundred articles, which reduces the workload by quite a bit. Eventually it would be a good idea to make the same changes in the database, so that there will be no need to do them on the fly. But the database is huge, and Father Pitt is a little reluctant to touch it.
Leave a Reply