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 = "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
Kevin Hazzard, C# MVP & Friend of Red Gate
http://devjourney.com
Sign In or Register to comment.