<?php 
function imageView($arr,$url)
{
$i = 1;
$picpage = $_GET['pic'];
$picpage = $picpage < 1 ? 1:$picpage;
$picpage = $picpage  == null ? 1:$picpage;
$picpage = $picpage > count($arr)? count($arr):$picpage;
foreach($arr as $value){
	$picurl = $value;
	if($i == $picpage){
		break;
	}
	$i++;
	}
	$l = $picpage -1;
	$left = '<a href="'.$url.'pic='.$l.'"> << </a>';
	if($picpage == 1){
	$left = '<a href="#"> << </a>';
	}
	$r = $picpage +1;
	$right = '<a href="'.$url.'pic='.$r.'"> >> </a>';
	if($picpage == count($arr)){
	$right = '<a href="#"> >> </a>';
	}
	$c = ' '.$picpage.'/'.count($arr).' ';
	$html .= '<div class="pic">';
	$html .='<div class="pic_view" style="text-align:center;">';
	$html .= '<img src="'.$picurl.'" alt="Loading...">';
	$html .= '</div>';
	$html .='<div class="pic_text" style="text-align:center">';
	$html .= $left.$c.$right;
	$html .= '</div>';
	$html .= '</div>';
	return $html;
}

?>