Welcome to the Invelos forums. Please read the forum rules before posting.

Read access to our public forums is open to everyone. To post messages, a free registration is required.

If you have an Invelos account, sign in to post.

    Invelos Forums->DVD Profiler: Layouts and Reports Page: 1  Previous   Next
Alternative Covers HTML windows
Author Message
DVD Profiler Unlimited RegistrantStar Contributornorthbloke
Registered: March 15, 2007
Reputation: High Rating
United Kingdom Posts: 5,459
Posted:
PM this userDirect link to this postReply with quote
OK, I thought I'd give this a go seeing how so many people seem interested in displaying covers other than those in the online database.
A lot of this code is cannibalised from the excellent Galleries window.
Copy & paste this into an HTML window (I called mine Front Cover)

Quote:

<HTML>
<HEAD>
<style type="text/css">
html, body { margin: 0pt;}
</style>
<SCRIPT TYPE="text/javascript">
<!--
<DP NAME="HEADER_VARS" Language="JavaScript" Comments="True" IncludeCast="False" IncludeCrew="False">
//-->

var cover = new Image();
var title = DP_Title;
var upc = DP_UPC;
var gsl = DP_ProgramPathImages;
var int = DP_Notes.indexOf("<release=");
if (int != -1) {
  var ims = DP_Notes.substring(int, DP_Notes.indexOf(">", int));
  ims = "." + ims.replace("<release=","");
} else {
  ims = "";
}
gsl += upc;
var imp = gsl + ims + "f.jpg"; // -----> CHANGE THIS FOR BACK COVER

function loadimage() {
cover.onerror = function (evt) {
imp =DP_ProgramPathImages + "blank.jpg";
cover.src = imp;
}
cover.src = imp;
var w = cover.width;
var h = cover.height;
// Check that image has loaded properly
if (w == 0) {
loadimage() }
else {
var w = cover.width;
var h = cover.height;
return }
}

function showpic(src, w, h) {
if (src == null) return;
var iw, ih; // Set inner width and height
if (window.innerWidth == null) {
iw = document.body.clientWidth;
ih=document.body.clientHeight;
}
else {
iw = window.innerWidth;
ih = window.innerHeight;
}
if (w == null) w = iw;
if (h == null)  h = ih;
if (w == 0) w = iw;
if (h == 0) h = ih;
var sw=iw;
var sh=ih;
if ((w*sh)/(h*sw)<1) sw=Math.round(w*sh/h);
else sh=Math.round(h*sw/w);
document.write('<table width="100%" height="100%" cellpadding="0" cellspacing="0"><tr><td height="'+ih+'" valign="middle" align="center"><img src="'+src+'" alt="' + title + '" width="'+sw+'" height="'+sh+'" align="middle" onClick="newWindow(\'' + imp + '\');return false;"></td></tr></table>');
}

function newWindow(img) {
  var pic = new Image();
  pic.src = imp;
  var doc = '<html><body style="margin:0;padding:0;background-color:black;"><img src="' + imp + '"></body></html>';
  var win = window.open("", 'Gallery', 'scrollbars=no, width=' + w +' height='+ h +' resizable, dependent, status=no');
  win.document.write(doc);
  win.document.close();
  win.resizeTo(w + 12, h + 38);
  win.focus();
}

</SCRIPT>

</HEAD>
<BODY scroll="no", onLoad="loadimage()", onResize="location.reload(true)">
<script language="javascript">
loadimage();
var w = cover.width;
var h = cover.height;
showpic (imp, w, h);

</script>
</BODY>
</HTML>


Repeat for another HTML window (I called mine Back Cover) and change the f.jpg (about 25 lines down) to b.jpg

USE:
This window looks for <release=1> in the Notes section. If it doesn't find it, it loads the normal covers.
The alternative covers must be stored in the same place as all the other covers. The naming of the image is very exact - full UPC code (including locality) then a ".1" (note the point) then either "f.jpg" for front, or "b.jpg" for back.
You need to create an image to use when there are no scans and call it blank.jpg (this is in case you have manual dvds with no covers in your profile). I just made a copy of the current image and renamed it.
I've written the code so that if you put a different number in the <release=x> bit, you can match it in the filename (so .x instead of .1) and it should still work. I'm hoping in the future to get it so you can change covers in the window, but not sure how to go about it yet! 

LIMITATIONS:
When the full-sized image opened in a new window, I couldn't get it to close by clicking away without IE giving me security warnings, so I removed that code. So you have to close the new window manually.

WARNING:
I had problems with the image width falsely being reported as zero, so I've included a routine that checks for this and forces the image to reload. It's never happened yet but in theory this could put the script into a permanent loop. If this happens, click on another profile.
 Last edited: by northbloke
    Invelos Forums->DVD Profiler: Layouts and Reports Page: 1  Previous   Next