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

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Keagel
Posts: 16
Joined: 29 Apr 2020 15:20

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

Post 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!

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

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

Post by highend »

viewtopic.php?t=23063

+ the link at the end of that thread...
One of my scripts helped you out? Please donate via Paypal

Keagel
Posts: 16
Joined: 29 Apr 2020 15:20

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

Post 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.

klownboy
Posts: 4397
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440

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

Post 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.

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

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

Post 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.

klownboy
Posts: 4397
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440

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

Post 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.

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

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

Post 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^^
One of my scripts helped you out? Please donate via Paypal

Norn
Posts: 483
Joined: 24 Oct 2021 16:10

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

Post by Norn »

:tup: Replace utf8 with utf16 to support special character paths.
Windows 11 24H2 @100% 2560x1440

Keagel
Posts: 16
Joined: 29 Apr 2020 15:20

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

Post 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?

Post Reply