RChilton Posted March 13, 2014 Share Posted March 13, 2014 So I have product images being added to a website the images are named 77777.jpg or 77777-2.jpg for regular photos and then 77777_1, 77777-2_1, 77777-2_2, etc for the set photos. Basically I want to restructure our naming of our photos. Right now the php is using a counter to add the images sequentially. Now I want to name the set images something like 77777_1a, 77777-2_1a and 77777-2_1d. Not sure how to change the counter function to add the photos since they are not sequential any more. The exiting code is below: if (hasAccessByLevel(6, 'LTE', $userName)){ echo ("<ul style=\"margin-top:20px;\"> <li><a href=\"images/productimages/large_$product[sku].jpg\" class=\"largeImage\">Download large image</a> <em>(right click, save as)</em> </li>"); 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 ("<li><a href=\"images/productimages/large_$product[sku]_$counter.jpg\" class=\"largeImage\">Download large set photo</a> </li>"); } } echo ("</ul>"); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.