Not logged in. · Lost password · Register
Forum: Features request RSS
Multiple Album Art Files
Avatar
Azimuth #1
Member since Jan 2003 · 427 posts · Location: Chicago, Illinois - USA
Group memberships: Members
Show profile · Link to this post
Is there a way to add support for more than one album art file type? It would be cool if you could specify a primary file type and have a secondary in case the first one does not exist.

In my case, I primarily use albumartsmall.jpg, but, if the larger, folder.jpg exists, that would be better.
Avatar
Henry (Administrator) #2
Member since Jan 2003 · 865 posts · Location: Munich Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You can do that with JavaScript. I don't have a code snippet for you but I'm sure it will work this (pseudocode) way:
if(primary_img.height == 1) primary_img.src = "secondary.jpg"
Avatar
Azimuth #3
Member since Jan 2003 · 427 posts · Location: Chicago, Illinois - USA
Group memberships: Members
Show profile · Link to this post
Great! Thanks, Henry. I'll give it a shot.  :-D
Avatar
Azimuth #4
Member since Jan 2003 · 427 posts · Location: Chicago, Illinois - USA
Group memberships: Members
Show profile · Link to this post
My try didn't work, so, I went hunting and found this page. Tried it out, but, it still does not work.

I did this...

function HandleImgError()
{
  document.art.src = "albumartsmall.jpg?src=<#CurrentTrackDirectory urlencoded=1>";
}

then, I added this...

<img name="art" onerror="HandleImgError()" src="folder.jpg?src=<#CurrentTrackDirectory urlencoded=1>"  width="165">

Anyone want to confirm this?  :-D
Avatar
Henry (Administrator) #5
Member since Jan 2003 · 865 posts · Location: Munich Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The onerror Event does not work with BrowseAmp 'cause BA checks the existence of a requested file and returns clearpixel.gif if the file does not exist.

But I worked out the following method for your purpose:

Insert the coverart image tag as follows. src="..." is the default image. It's important to give it an ID:
<img src="<#artist urlencoded=1>.jpg?src=<#CurrentTrackDirectory urlencoded=1>" id="coverart" border="0">
Add a JavaScript function in HTML's head section:
function changeImage()
 {
 if(document.getElementById("coverart").width == 1)
  {
  document.getElementById("coverart").src = "<#inifile section=layout key=coverfilename default=front.jpg>?src=<#CurrentTrackDirectory urlencoded=1>";
    }
 document.getElementById("coverart").width = <#inifile section=layout key=showwidth default=400>;
 document.getElementById("coverart").height= <#inifile section=layout key=showheight default=400>;
 }
And at last call this function with the body's onload event (taken from eXtended skin here):
<body text="#FFFF00" bgcolor="#000033" link="#CCCCCC" vlink="#CCCCCC" alink="#FFFFFF" leftmargin="3" topmargin="3" marginwidth="3" marginheight="3" onLoad="ReloadPage();resizeFrame();changeImage();" onResize="resizeFrame();">
The changeImage function checks whether the correct cover art file was loaded (which has width > 1 in most cases...) or the clearpixel (width==1) was sent from the server. In that case the src property is changed an finally the images are resized to the designated look.
This post was edited on 2004-08-10, 12:51 by Unknown user.
Avatar
Azimuth #6
Member since Jan 2003 · 427 posts · Location: Chicago, Illinois - USA
Group memberships: Members
Show profile · Link to this post
The onerror Event does not work with BrowseAmp 'cause BA checks the existence of a requested file and returns clearpixel.gif if the file does not exist.
Glad to see that I did not break it! :P

I also now see why you were doing a "== 1" in your pseudo code.   ;)

I'll try this tonight. Thanks again, Henry!
Avatar
Azimuth #7
Member since Jan 2003 · 427 posts · Location: Chicago, Illinois - USA
Group memberships: Members
Show profile · Link to this post
Works well for me!  Thanks yet again, Henry! :D

I s'pose, then, I should add the programmable-cover-art-file-name stuff from the extended skin into BATS8 soon...  :whistling:
Avatar
Azimuth #8
Member since Jan 2003 · 427 posts · Location: Chicago, Illinois - USA
Group memberships: Members
Show profile · Link to this post
This code no longer works for me. Can someone please confirm?  :blink:
Avatar
Azimuth #9
Member since Jan 2003 · 427 posts · Location: Chicago, Illinois - USA
Group memberships: Members
Show profile · Link to this post
Ah, ha! I think I figured this out...

When I load the graphic, I scale it to the "correct" size...

<img src="/folder.jpg?src=<#CurrentTrackDirectory urlencoded=1>" id="coverart" border="0" width="84">

When I check the size, it returns 84! The scaled size, not the actual size!

Now to try and work around this...

Tony
This post was edited on 2005-04-17, 23:50 by Unknown user.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Page created in 184.4 ms (88.7 ms) · 78 database queries in 70.8 ms
Current time: 2018-08-16, 21:45:32 (UTC +00:00)