Thanks highend and jupe. I tested both methods in my scenario and they work fine. More straightforward than what I came up with as shown below.
The script is intended to work with selected files in the current image folder. So, I'm able to determine the associated cache file(s) easily. I had the not so brilliant idea of updating the "Mod" key in the [Thumb #] section. Only because, if XYplorer detects a change in the image file's modified date, it will rewrite the thumbnail(s) (dbits file) which seems unnecessary if you
know for a fact that it was only the date that changed and not the actual image. In that case, the associated thumbnail shouldn't have to be updated. Like I said it was a bit whacky. Thanks again.
Code: Select all
$cachefile = get("thumbs_cache"); //cache file current folder
$cachefile_ini = replace($cachefile, "dbits", "ini"); //associated cache ini
$ini = readfile($cachefile_ini);
foreach($image, <selitems <crlf>>, <crlf>, "e") {
$image_name = gpc($image, "name");
$pos = strpos($ini, "File" . "=" . $image_name);
$ini_new = readfile($cachefile_ini,, 50,,$pos);
$thumb = gettoken($ini_new, 3, <crlf>);
if($thumb) {
$thumb = substr($thumb, 7, -1)-1;}
else {
$thumb = getkey("CountThumbs", "General",$cachefile_ini);} // for the last thumb in ini sections
}