for($i = $begin_with; $i < $end_with; $i++) {
- $images[$rows][$cols] = $photos[$i];
- $img_id[$rows][$cols] = $i;
- $img_name[$rows][$cols] = htmlspecialchars($this->getPhotoName($photos[$i], 15));
- $img_title[$rows][$cols] = "Click to view photo ". htmlspecialchars($this->getPhotoName($photos[$i], 0));
+ if(isset($photos[$i])) {
- $thumb_path = $this->get_thumb_path($this->cfg->thumb_width, $photos[$i]);
+ $images[$rows][$cols] = $photos[$i];
+ $img_id[$rows][$cols] = $i;
+ $img_name[$rows][$cols] = htmlspecialchars($this->getPhotoName($photos[$i], 15));
+ $img_title[$rows][$cols] = "Click to view photo ". htmlspecialchars($this->getPhotoName($photos[$i], 0));
- if(file_exists($thumb_path)) {
- $info = getimagesize($thumb_path);
- $img_width[$rows][$cols] = $info[0];
- $img_height[$rows][$cols] = $info[1];
- }
+ $thumb_path = $this->get_thumb_path($this->cfg->thumb_width, $photos[$i]);
- if($cols == $this->cfg->thumbs_per_row-1) {
- $cols = 0;
- $rows++;
- $images[$rows] = Array();
- $img_width[$rows] = Array();
- $img_height[$rows] = Array();
- }
- else {
- $cols++;
- }
- }
+ if(file_exists($thumb_path)) {
+ $info = getimagesize($thumb_path);
+ $img_width[$rows][$cols] = $info[0];
+ $img_height[$rows][$cols] = $info[1];
+ }
+
+ if($cols == $this->cfg->thumbs_per_row-1) {
+ $cols = 0;
+ $rows++;
+ $images[$rows] = Array();
+ $img_width[$rows] = Array();
+ $img_height[$rows] = Array();
+ }
+ else {
+ $cols++;
+ }
+ }
+ }
// +1 for for smarty's selection iteration
$rows++;