WayBack Runtime Lost Photo/IMG Retrieve Plugin/Patch/Fix

Started by NightWolve, 07/21/2021, 08:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

NightWolve

Synopsis: Dead/broken IMG links plague forums in Random Photo Threads like these, but what if runtime JavaScript could loop through broken/missing images, prepend a special WayBack link (https://web.archive.org/web/0im_/) to search for them in their database and seamlessly return the lost image ??  :-k  Let's try!

http://www.sparkcaster.com/demotivational/images/a%20pony.jpg
IMG
IMG



Dead IMG Link:
https://www.storochliten.se/themes/storochliten/content/images/stor-och-liten-symbol-large.png

Working via WayBack:
Quote from: Fidde_se on 03/24/2018, 05:34 AMBack in the 80 we had Big&Little that was THE toystore here back then, that has somehow
remerged online for being gone in like 20 years time, nostalgic for us...

That logo is for us what TRU are for Americans.
IMG


Dead IMG Link (11 years old):
http://chzgifs.files.wordpress.com/2010/09/girlsfartp1.gif

Quote from: Tatsujin on 12/02/2010, 04:26 AMIMG


Dead IMG Link (10 years old):
http://asset.soup.io/asset/1180/6135_062f.png

Quote from: Tatsujin on 01/02/2011, 12:31 PMIMG

I waslike WTHMF :lol:


Dead IMG Link (10 years old):
http://images.paraorkut.com/img/funnypics/images/b/bruce_lee_loves_birthdays-13330.jpg

IMG



Here's one of the more interesting cases with lifetime member and former mod GameSack Joe Redifer! When he started off, turns out instead of using his later joeredifer.com domain to share images, he owned/used pixelcraze.film-tech.net circa 2002 (then pixelcraze.com)!

An example post in question:
https://www.pcengine-fx.com/forums/index.php?topic=3082.msg40362#msg40362

In it, he shared this "pixelcraze.film-tech.net/crap/turbogames.jpg", but that domain is dead and not many files are found on Way Back!

So is all hope lost ? No, I remembered his /crap/ folder being associated with joeredifer, so what if I swap domains and try looking in WayBack again ???

Before : pixelcraze.film-tech.net/crap/turbogames.jpg
After  : joeredifer.com/crap/turbogames.jpg

IMG

And voila, now it works, the image can found! *catches breath* But, it's not over yet, searching the forum with Joe's "pixelcraze.film-tech.net" which became "pixelcraze.com" returns dozens of results (60+), so a global find/replace to "joeredifer.com" is needed to lead to most images from 2006-2007 working again! A little more grunt work to recover what is lost, but I made a script for that. It's a bit dangerous though, no mistakes can be made, you make sure the text is 100% unique, no undos if you make a mistake!

So yeah, it's an interesting case where a little extra effort can recover more images/history! :thumbsup:



And so on. It's hit or miss, since Aaron kept the forum mostly private in its 2 decades, spiders couldn't archive as much, so if the link was only posted here and nowhere else, it's likely gone forever...

The JavaScript code goes something like this, just a single function called on the onload() event and relies on the fact that SMF forums will set dead image objects to width=0/height=0 so they're not noticed. This idea happened on accident as I was trying to track down where this is happening to stop SMF from setting their dimensions to zero since I want to know a link is dead to fix it manually. But with runtime code you can fix some cases automatically by way of WayBack magic. :thumbsup:

function ShowLostImages() {
var aLink1, aLink2;
for ( i = 0; i < document.images.length; i++ )
if ( document.images[i].width == 0 || (!document.images[i].complete && document.images[i].width <= 28) ) {
document.images[i].border = 1;
aLink1 = document.images[i].src;
document.images[i].alt = document.images[i].title = aLink1;
aLink2 = "https://web.archive.org/web/0im_/" + aLink1;
document.images[i].src = aLink2;
aLink1 = "https://archive.org/..." + aLink1.substring(aLink1.lastIndexOf("/"));
document.images[i].outerHTML += "<BR><b><font color=red>WayBack Repair:</font></b> <a href=\"" + aLink2 + "\" target=\"_blank\">" + aLink1 + "</a>";
         
document.images[i].onclick = function(event) {
var a = document.createElement("a");
a.target = "_blank";
a.href = this.src;
a.click();
}
}
}