by trixmoto » Tue Apr 01, 2008 6:21 am
I think you need to have a physical file, unfortunately. Personally I've found this method best...
Code: Select all
Set img = itm.AlbumArt.AddNew
img.RelativePicturePath = relpath(newpath,itm.Path)
img.ItemType = 3
img.ItemStorage = 0
Where "relpath" is...
Code: Select all
Function relpath(relp,path)
relpath = relp
Dim temp : temp = Left(path,InStrRev(path,"\"))
'check same folder
If InStr(relp,temp) = 1 Then
relpath = Mid(relp,Len(temp)+1)
Exit Function
End If
'check parent folders
If Left(temp,2) = "\\" Then
temp = Mid(temp,3)
End If
If Left(relp,2) = "\\" Then
relp = Mid(relp,3)
End If
Dim tp : tp = Left(temp,InStr(temp,"\"))
Dim tr : tr = Left(relp,InStr(relp,"\"))
If (UCase(tp) = UCase(tr)) Then
While (UCase(tp) = UCase(tr))
temp = Mid(temp,Len(tp)+1)
relp = Mid(relp,Len(tr)+1)
tp = Left(temp,InStr(temp,"\"))
tr = Left(relp,InStr(relp,"\"))
WEnd
relpath = ""
While (InStr(temp,"\") > 0)
relpath = relpath&"..\"
temp = Mid(temp,Len(tp)+1)
tp = Left(temp,InStr(temp,"\"))
WEnd
relpath = relpath&relp
End If
End Function
I think you need to have a physical file, unfortunately. Personally I've found this method best...[code]Set img = itm.AlbumArt.AddNew
img.RelativePicturePath = relpath(newpath,itm.Path)
img.ItemType = 3
img.ItemStorage = 0[/code]
Where "relpath" is...[code]Function relpath(relp,path)
relpath = relp
Dim temp : temp = Left(path,InStrRev(path,"\"))
'check same folder
If InStr(relp,temp) = 1 Then
relpath = Mid(relp,Len(temp)+1)
Exit Function
End If
'check parent folders
If Left(temp,2) = "\\" Then
temp = Mid(temp,3)
End If
If Left(relp,2) = "\\" Then
relp = Mid(relp,3)
End If
Dim tp : tp = Left(temp,InStr(temp,"\"))
Dim tr : tr = Left(relp,InStr(relp,"\"))
If (UCase(tp) = UCase(tr)) Then
While (UCase(tp) = UCase(tr))
temp = Mid(temp,Len(tp)+1)
relp = Mid(relp,Len(tr)+1)
tp = Left(temp,InStr(temp,"\"))
tr = Left(relp,InStr(relp,"\"))
WEnd
relpath = ""
While (InStr(temp,"\") > 0)
relpath = relpath&"..\"
temp = Mid(temp,Len(tp)+1)
tp = Left(temp,InStr(temp,"\"))
WEnd
relpath = relpath&relp
End If
End Function[/code]