here’s my code:
<?php
$class = array();
/*$class = array_reverse($class_model, false);*/
$cycle = 199 ;
$i= 0;
$contentdirectory = 'DEADWAVE_proj_dir/DEAD-WAVE_content/';
$contentlaunch = scandir($contentdirectory);
natsort($contentlaunch);
$id = count($contentlaunch);
foreach ( $contentlaunch as $value )
{
if ( preg_match("/.png",$value)
|| preg_match("/.jpg",$value)
|| preg_match("/.gif",$value) )
{
echo '<a id="'.--$id.'"target="_blank" href="">
<img class="'.$class[ $i % $cycle ].'"
src="DEADWAVE_proj_dir/DEAD-WAVE_content/'.$value.'"/></a>';
++$i;
}
}
?>
this simply doesn’t work, the question is why.
I imagined that it would work to check the file type and echo img tags for only those array values that are images avoiding the non image files in the directory. I’m open to every solution.
note: I would not use this method to check for imagess, but brian_d method:
finally, I’m not sure about all the $class/$cycle stuff…