Image Custom Column: use jpg or png

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
maslah
Posts: 6
Joined: 02 Sep 2021 11:17

Image Custom Column: use jpg or png

Post by maslah »

Is it possibel to auto assing jpg or png for the Custom Column Image, depending what file exists?

Something like:

Code: Select all

if (.\fpic\<cc_base>.png) {
    return ".\fpic\<cc_base>.png";
} else {
    return ".\fpic\<cc_base>.jpg";
}

admin
Site Admin
Posts: 65107
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Image Custom Column: use jpg or png

Post by admin »

Absolutely. Check out the exists() function.

maslah
Posts: 6
Joined: 02 Sep 2021 11:17

Re: Image Custom Column: use jpg or png

Post by maslah »

Took me a little to long, because I forgot to switch the Custom Colum Type to Script :oops: . This works:

Code: Select all

$pngfile = ".\fpic\<cc_base>.png";
$jpgfile = ".\fpic\<cc_base>.jpg";

if(exists($pngfile) == "1") {
   return $pngfile;
} else {
   return $jpgfile;
}

Post Reply