Q: How to manually generate thumbnails

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
jaywalker32
Posts: 214
Joined: 27 May 2014 05:24

Q: How to manually generate thumbnails

Post by jaywalker32 »

How can I generate the thumbnail cache for a set of folders before actually navigating to them? So that when I do decide to navigate to them, the thumbnails are already generated and I don't have to wait on them.

Is there maybe a script command or a setting for this?

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

Re: Q: How to manually generate thumbnails

Post by klownboy »

That's a good question actually. You manually generate or build thumbnail by navigating to the folder, select the thumbnail mode you desire and XY automatically builds the thumbnails or you use CID #501 or View | Caches | Refresh Thumbnails. The point is, it's normally accomplished by being in the folder. If you haven't already, take a look at the Thumbnail Maintenance script here http://www.xyplorer.com/xyfc/viewtopic. ... 45#p110631 That script will allow you to build or refresh thumbnails in a variety of ways, some even do it in the background using a second instance of XY, but I'm afraid none of the options do exactly what you want.

I could possibly build another option where you could select a folder (using SC inputfolder) and build the thumbnails for that folder in the background, in a second instance of XY without having to navigate to the folder at least not in the first instance of XYplorer. I had thought of doing something similar but never did.

jaywalker32
Posts: 214
Joined: 27 May 2014 05:24

Re: Q: How to manually generate thumbnails

Post by jaywalker32 »

Thanks. I think the 'build cache for this folder and subs' option will enable me to leave it overnight and generate the cache for my whole pictures folder.

Was just checking if there was an obvious in-built option I was missing. The ideal being able to generate the thumbnails in the background.

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

Re: Q: How to manually generate thumbnails

Post by klownboy »

If you can do the build in the foreground, that's probably best. I have some folders which have approximately 5000 high quality photos and building/rebuilding the caches doesn't take that long (i.e., it's complete after a meal as opposed to leaving overnight).

I've had another update for the Thumbnail Maintenance script ready for some time now which will properly recognize the 'Zoom to Fill' option. Before issuing that I'll experiment with the possibility of an option discussed above.

jaywalker32
Posts: 214
Joined: 27 May 2014 05:24

Re: Q: How to manually generate thumbnails

Post by jaywalker32 »

I actually only need a small fraction of the functionality so I looked through your code and extracted/modified the bit I was looking for:

This will traverse the directory tree and just change the view to Thumbnails #2 and let the system do the rest.

Code: Select all

 $dirs = folderreport("dirs", "r", , "r" );
   foreach($dir, $dirs, "<crlf>"){
       goto $dir;
       #307;    //function code for Thumbnails #2
   }


Thanks again!
Last edited by jaywalker32 on 29 Apr 2016 21:05, edited 2 times in total.

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

Re: Q: How to manually generate thumbnails

Post by highend »

Just a small annotation regarding your script:

Code: Select all

$dirs = folderreport("dirs", "r", , "r" );
quicksearch() is a few times faster than folderreport :)

Code: Select all

$dirs = quicksearch("/d");
So this takes only a fraction of the time. I know, thumbnail generation is what takes time, not folder finding but I just wanted to mention it
One of my scripts helped you out? Please donate via Paypal

jaywalker32
Posts: 214
Joined: 27 May 2014 05:24

Re: Q: How to manually generate thumbnails

Post by jaywalker32 »

Ok, cool.

I had no idea that the script will wait for the thumbnails to be generated before looping to the next folder. Which is what prompted this post in the first place. I thought it would require extra code to monitor and wait. Forgot it's all single threaded.

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

Re: Q: How to manually generate thumbnails

Post by klownboy »

The code you have above is fine if you are building the thumbnails for the first time as you mentioned. If however, over time you have renamed, deleted or moved images in those folders, those old thumbnails will remain in the thumbnail cache database making it much larger than it should be. That was the primary reason for the script I referred to above. So if you later return to the folders after having done a bunch of file work mentioned, keep in mind that to properly rebuild the bloated thumbnail nail cache, you need to also run CID #501. At that point though, with the folders already in the thumbnail database, you're better off using the script to rebuild.

Post Reply