Detecting Report Image Location
wkhazzard
Posts: 20
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:
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
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
http://devjourney.com