function showPhotoTable($filePath) { $count = 0; //echo $filePath; $photoArr = glob($filePath . "/thumbs/*.jpg"); //sort($photoArr); $maxValue = getMaxPhotoNumber($photoArr); //echo "max = ".$maxValue; //echo "count = ".array_pop($photoArr); echo "<table cellpadding='5px' cellspacing='5px'>"; echo "<tr>"; $theme = isset(Yii::app()->request->cookies['dynamicTheme']->value) ? Yii::app()->request->cookies['dynamicTheme']->value : "dark"; $borderColor = $theme == "dark" ? "#ffffff" : "#000000"; // for ($i = 1; $i <= count($photoArr); ++$i) for ($i = 1; $i <= $maxValue; ++$i) { $filename = $filePath . "/thumbs/" . $i . ".jpg"; if (file_exists($filename)) { $size = getimagesize($filename); $width = $size[0]; $height = $size[1]; $ref = Yii::app()->getUrlManager()->createUrl('/portfolio/showGallery', array("filepath" => $filePath, "initial" => $count)); if ($width >= $height) { $width = 150; $coeff = $width / $size[0]; $height *= $coeff; $height = 100; echo "<td align='center' width='150px' >"; echo "<a href='{$ref}' style='margin:0'>"; echo "<img width='{$width}' height='{$height}' src='{$filename}' style='margin:0;border:1px solid {$borderColor}'/>"; echo "</a>"; echo "</td>"; } else { $height = 100; $coeff = $height / $size[1]; $width *= $coeff; echo "<td align='center' width='150px' >"; echo "<a href='{$ref}' style='margin:0'>"; echo "<img width='{$width}' height='{$height}' src='{$filename}' style='margin:0;border:1px solid {$borderColor}'/>"; echo "</a>"; echo "</td>"; } // else $count++; if ($count % 4 == 0) { echo "</tr><tr>"; } // if } // if } // foreach // foreach($photoArr AS $filename) // { // $filename = $filePath."/thumbs/".$i.".jpg"; // if(file_exists($filename)) // { // $size = getimagesize($filename); // $width = $size[0]; // $height = $size[1]; // // $ref = Yii::app()->getUrlManager()->createUrl('/portfolio/showGallery', array("filepath" => $filePath, "initial" => $i)); // // if ($width >= $height) // { // $width = 150; // // $coeff = $width / $size[0]; // $height *= $coeff; // $height = 100; // // echo "<td align='center' width='150px' >"; // echo "<a href='$ref' style='margin:0'>"; // echo "<img width='$width' height='$height' src='$filename' style='margin:0;border:1px solid $borderColor'/>"; // echo "</a>"; // echo "</td>"; // } // if // else // { // $height = 100; // $coeff = $height / $size[1]; // $width *= $coeff; // echo "<td align='center' width='150px' >"; // echo "<a href='$ref' style='margin:0'>"; // echo "<img width='$width' height='$height' src='$filename' style='margin:0;border:1px solid $borderColor'/>"; // echo "</a>"; // echo "</td>"; // } // else // // $count++; // if ($count % 4 == 0) // { // echo "</tr><tr>"; // } // if // } // if // } // foreach echo "</tr>"; echo "</table>"; }
// foreach return $max; } // sortPath /** * Created by JetBrains PhpStorm. * User: Noktigula * Date: 04.11.12 * Time: 1:15 * To change this template use File | Settings | File Templates. */ //echo $initial; echo "<div id='fotorama'>"; //$initial--; $photoArr = glob($filepath . "/*.jpg"); $max = getMaxPhotoNumber($photoArr); for ($i = 1; $i <= $max; ++$i) { $filename = $filepath . "/" . $i . ".jpg"; if (file_exists($filename)) { echo "<img src='{$filename}'/>"; } // if file exists } //foreach (glob($filepath."/*.jpg") as $filename) //{ // echo "<img src='$filename'/>"; //} // foreach echo "</div>"; echo "</body>"; $theme = isset(Yii::app()->request->cookies['dynamicTheme']->value) ? Yii::app()->request->cookies['dynamicTheme']->value : "dark"; $bg = $theme == "dark" ? "'black'" : "'white'";