How can we help you today? How can we help you today?

Detecting Report Image Location

After generating a SQL compare report in HTML, I like to be able to send the report to my mates without having to zip up the images folder. But I always have to modify the HTML inserting the following code to auto-detect whether or not the images folder is local or remote:
var reportFileName = "Whatever v Whichever";
var remoteImagesDir = "http://www.red-gate.com/scimages/";
var localImagesDir = reportFileName + "_images\\";
var imagesdir = localImagesDir;
var testImage = new Image();
testImage.onerror = function () { imagesdir = remoteImagesDir; };
testImage.src = localImagesDir + "LeftDatabase32.gif";

I also delete the invocation of the SetupImagesDir() function in pageInit(). I wish the report generator did all of this for me.

Cheers,

Kevin Hazzard, C# MVP & Friend of Red Gate
wkhazzard
0

Add comment

Please sign in to leave a comment.