Problems getting the correct path on conditional subfolders

Somehow I'm stuck...

I wanna show the artist's picture (located in the artist's folder) this way:

	<object data="%_parent_directory%\Artist.jpg" type="image/jpg" width="150" height="150" border="0"> 
	<img src="noartist.jpg" alt="Photo not found" />
	</object> 

That works correctly when the folder structure is ...\Artist\Album\Track.mp3.
But it's always the wrong path if the tracks are located in an extra subfolder of Album like CD1 or BonusDisk, etc.

Is there a way to provide this without copying artist.jpg into those subfolders?

Try to find out whether such formatstrings in principle can help ...

$replace(%_path%'*',%_filename_ext%'*',)'Artist.jpg' $len($regexp(%_folderpath%,'[^\\\\]',)) $if($eql(%ALBUM%,%_directory%),%_folderpath%,%_folderpath%'..\')'Artist.jpg'

DD.20150921.1738.CEST, DD.20150921.1803.CEST, DD.20150921.1817.CEST

Unfortunately that seems not to be a solution as I still get only the wrong path.

My first thought was to use a regexpr. Some kind of a split and returning such way the folder before %_parent_directory%. But I don't know how to pass the folder depth as parameter for the returning regexpr replace.

Well, hard to explain it easier lol In Delphi or VB I would use something like "beforelast(%_parent_directory%,""). But how to do such in Mp3tag's script language... My first look at this language was a few days ago.

I just have tested following code but I get only an empty result.

$puts(fldr,$mid(%_parent_directory%,1,$strrchr(%_parent_directory%,\)))
$get(fldr)

%_parent_directory% ... is just the name of the folder.

DD.20150921.1843.CEST

Argh, you're right! I have to use %_folderpath_rel% instead.

CODE
$puts(fldr,%_folderpath_rel%) $puts(fldr,$mid($get(fldr),1,$strchr($get(fldr),\))) :smiley: