I have a PHP code to see if one or many pictures exist. If the picture exist I could like to count them and echo the answer. This is my code:
<?php
//Start Pictures section - dictates that if there are pictures this section is shown - if not this section is now shown.
for ($x=1; $x<=21; $x++) {
if($x<=9) {
$picValue = 'picture0'.$x;
}
else {
$picValue = 'picture' . $x;
}
$imageURLpixel = ABSOLUTE_URL_IMG.$code.'/pixel/'. $picValue .'.jpg';
//Check if the image exists or not
$pictureCount = 1;
if (@fopen($imageURLpixel,'r')) {
$pictureCount++;
$pictureCounter = count($pictureCount);
}
echo $pictureCounter;
}
?>
I have 3 pictures in my exampe and it is being output as 111111111111111111111 - I would the output to be as 3. I am not getting any errors in my error log.