Page 1 of 1

Using the thumbnail of the subfolder as the thumbnail of the current folder

Posted: 03 Mar 2022 17:24
by Keagel
Hello,

Here is my use case:

Folder1
--- Subfolder 1
------ Sub-subfolder
--------- Picture1.jpg
--- Subfolder 2
------ Sub-subfolder
--------- Picture1.jpg
--- Subfolder 3
------ Sub-subfolder
--------- Picture1.jpg

Sub-subfolders (in blue) have thumbnails while subfolders (in red) don't have any thumbnails. Considering each subfolder (red) only has one sub-subfolder, is there any way to make it so the subfolders (red) inherit the thumbnails? Or is there a way to generate thumbnails manually and apply them to those subfolders?

Thank you!

Re: Using the thumbnail of the subfolder as the thumbnail of the current folder

Posted: 03 Mar 2022 17:52
by highend
viewtopic.php?t=23063

+ the link at the end of that thread...

Re: Using the thumbnail of the subfolder as the thumbnail of the current folder

Posted: 03 Mar 2022 18:39
by Keagel
Thank you, it is the link at the end of the thread that ended up working for me. I had to modify it a little to actually create the desktop.ini file for images in sub-subfolders:

Code: Select all

    foreach($folder, <get SelectedItemsPathNames <crlf>>, <crlf>, "e") {
        $image = quicksearch("*.jpg /limit=1", $folder);

        if !(exists($image)) { continue; }

        $image_relative_path = replace($image, $folder . "\", "");
        $desktopIni = $folder . "\desktop.ini";

        $content = <<<>>>
[ViewState]
Mode=
Vid=
FolderType=Pictures
Logo=$image_relative_path
>>>;
        writefile($desktopIni, $content, , "utf8");
        attrstamp("hs", , $desktopIni);
    }
    status "Done...";
Edit: actually the relative path doesn't work. I don't understand why as the path is correct. Full paths work.

Re: Using the thumbnail of the subfolder as the thumbnail of the current folder

Posted: 03 Mar 2022 22:15
by klownboy
Over on this thread viewtopic.php?f=5&t=24054 not too long ago, I had wished for the top folder to display the thumbnail of the folder beneath it, if no other options were available like folder.jpg, an image file, or desktop.ini, etc. If it was bought into (it wasn't), you wouldn't have to use a desktop.ini file. When located in your Sub folder1, it would have automatically shown the folder thumbnail of Sub-folder when no images were in Sub folder1. In this case, that folder thumbnail would have been of Picture1.jpg.

Re: Using the thumbnail of the subfolder as the thumbnail of the current folder

Posted: 03 Mar 2022 22:34
by jupe
As an alternative to desktop.ini, theoretically you could just create symlinks called folder.jpg (or whatever name really) to the subfolder image that you wanted, it could also probz be attr +h.

Re: Using the thumbnail of the subfolder as the thumbnail of the current folder

Posted: 04 Mar 2022 11:50
by klownboy
Nice idea jupe. It works. I tried it using a link to an image (jpg) and hid it. If a user needs to perform this numerous times, I'd recommend a simple script especially if they wanted to hide link file as well.

Re: Using the thumbnail of the subfolder as the thumbnail of the current folder

Posted: 06 Mar 2022 12:26
by highend
A probably slightly more sophisticated script for it (it only uses desktop.ini files, symlinks would require admin permissions)

It works on selected folders or if none are selected on the current path and automatically creates necessary desktop.ini files in all those directories which have a subdirectory with image files in it. So you could use it for even deeper nested hierarchies. Use it at your own risk^^

Re: Using the thumbnail of the subfolder as the thumbnail of the current folder

Posted: 06 Mar 2022 14:57
by Norn
:tup: Replace utf8 with utf16 to support special character paths.

Re: Using the thumbnail of the subfolder as the thumbnail of the current folder

Posted: 09 Mar 2022 16:57
by Keagel
Thanks for everyone's input! Sorry, I forgot about this topic. I'd rather use desktop.ini files instead of symlinks so the current solution works perfectly well for me. Still, I notice that the script you posted (highend) also uses full paths. Is it because relative paths don't work to generate thumbnails for you either?