pda4me
asked on
PHP snippet change not working
I am using the following PHP snippet to loop through a directory of images and display thumbnails. The script is currently hard-coded to display up to 10 images. I am changing the value where you see 10 to increase to 20 photos. I figured this was a simple change, but even when I change all instances of 10 to 20 it STILL only shows 10 images? What am I missing here?
<?
$image = "<br>";
$img_cnt = 1;
$image .= "<a href=/feeds/sancap/rets_images/$MLNumber.jpg rel=\"enlargeimage\" rev=\"targetdiv:loadarea\"><img src=/feeds/sancap/rets_images/$MLNumber.jpg alt='' width='100' height='75' border='0' /></a> ";
for ($c=1;$c<10;$c++) {
if ($c<10)
$c_ext = "0".$c;
else
$c_ext = $c;
if (file_get_contents("http://www.mydomain.com/feeds/sancap/rets_images/{$MLNumber}_{$c_ext}.jpg"))
$image .= "<a href=/feeds/sancap/rets_images/{$MLNumber}_{$c_ext}.jpg rel=\"enlargeimage\" rev=\"targetdiv:loadarea\"><img src=/feeds/sancap/rets_images/{$MLNumber}_{$c_ext}.jpg alt='' width='100' height='75' border='0' /></a> ";
else
$c=12;
$img_cnt++;
if ($img_cnt == 5) {
$image .= "<br>";
$img_cnt = 0;
}
}
?>
This script, as it stands, will bomb out if it fails to find one image in the sequence so if you have missed named an image that could stop the script working.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!