Detecting Report Image Location

wkhazzardwkhazzard Posts: 20
edited March 8, 2011 10:47AM in SQL Compare Previous Versions
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 = "";
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.


Kevin Hazzard, C# MVP & Friend of Red Gate
Kevin Hazzard, C# MVP & Friend of Red Gate
Sign In or Register to comment.