I want to simple skip files with filename that ends with "@2x" and implement in this code:
$fullres = glob("gallery/*.*");
for ($i=0; $i<count($fullres); $i++)
{
$num = $fullres[$i];
echo '<a href="'.$num.'" ><img src="/slir/?w=60&h=80&c=3x4&q=85&i=/'.$num.'" alt="" /></a>';
}
Is it actually possible?
You shouldn't use substr()
cuz than you are assuming that file name won't have any periods, instead use pathinfo
<?php
$fullres = glob("gallery/*.*");
foreach($fullres as $num) {
$fetch_file_name = pathinfo($num); //Fetch the file name with extension
$match_str = substr($fetch_file_name['filename'], -3); //Crop the file name
if($match_str != '@2x') {
echo '<a href="'.$num.'" ><img src="/slir/?w=60&h=80&c=3x4&q=85&i=/'.$num.'" alt="" /></a>';
}
}
?>