I have some code I trying to rework, having problems figuring out how to restructure it. I have product skus that are for example (22222, 33333-2, etc.) These skus all have images associated and named with the sku number. There are also additional photos for each sku and they are named (22222_1, 22222_2 and 33333-2_1, 33333-2_1) now I need to change the naming of the additional images to things like (22222_1a ad 33333-2_1s and 33333-2_2s). I can not figure out how to restructure the foreach loop. Currently it has a counter working so it displays the images based on the skus sequentially if there is _1 image. Since I will not be renaming all the old images I need it work for both the naming and the new naming. I’ve tried multiple things - I think it keeps getting hung up because of the $counter - but not sure how to use that with the new numbering system.
[php]if (file_exists(“images/productimages/med_$product[sku].jpg”)) { //Display dropout photo
echo ("
if (file_exists(“images/productimages/med_$product[sku]1.jpg")) { //Display thumbnails if set photo exisits //Display dropout thumb |
//Download Large Image
if (hasAccessByLevel(6, ‘LTE’, $userName)){
echo ("<ul style=“margin-top:20px;”>
if (file_exists(“images/productimages/large_$product[sku]1.jpg")) { //if set photo exists
$counter = 0 ;
foreach (glob("images/productimages/large$product[sku]*.jpg") as $filename) { //Loop through set photos
if($counter++ < 0) continue ;
echo ("
“);
}
}
echo (””);
}[/php]