Is the method correct?
3 different data types:
$dir = "./content/media/artworks";
// ignore jpg-pictures if the name '_th' appears. And files with 'txt' extension.
$imgs = glob($dir.'/*{[!_th].jpg,*.[!txt]}', GLOB_BRACE);
// Just take jpg images with the name '_th'
$thumbs = glob($dir.'/*?_th.*');
// Just take files with 'txt' extensions
$txts = glob($dir.'/*?.txt');
The first pattern for glob is wrong. This here * [._th]. Jpg does not mean that before.jpg is not a "_th", It means that the last character before the point not be permitted '_'. no 't' and no 'h'.
Use array_diff() to get all jpg-files which not contain thumbs.
$thumbs = glob($dir.'/*_th.jpg');
$jpgWithoutThumbs = array_diff(glob($dir.'/*.jpg'), $thumbs);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.