<?
if($result_code == '0000') {
    echo '0000|||||';
    $row_count = count($list);

    if($row_count > 0) {

        $max_rand_num = $limit-1;
        if($total_count < $limit)     $max_rand_num = $total_count-1;

        $relation_count = 8;
        if($total_count < 8)     $relation_count = $total_count;
        foreach($list as $val) {
            $idx        =$val['idx'];
            $main_img   =$val['main_img'];

//            $info       = getimagesize(WWW_CROSSMAP.$main_img);
//            $img_width 	= $info[0];
//            $img_height = $info[1];
//            $img_mime   = $info[2];

            $title_text = 	$val['title'];
            if($val['category_name']!='')	$title_text.= ' - '.$val['category_name'];

            //$img_type = array('1'=>'GIF', '2'=>'JPG','3'=>'PNG','4'=>'PSD','5'=>'BMP','6'=>'TIFF','7'=>'TIFF','8'=>'JPC','9'=>'JP2','10'=>'JPX','11'=>'JB2','12'=>'SWC','13'=>'IFF','14'=>'WBMP','15'=>'XBM');


            switch ($val['content_type']) {
                case '1': $img_view_url = '/web/news/news_view/'.$val['idx'];	$content_name='뉴스'; $content_main_url='/web/news'; break;
                case '2': $img_view_url = '/web/news/column_view/'.$val['idx'];	$content_name='칼럼'; $content_main_url='/web/news/column'; break;
                case '3': $img_view_url = '/m/life/life_view/'.$val['idx'];	$content_name='라이프'; $content_main_url='/web/life'; break;
            }



?>

            <a href="javascript:;" title="<?=$title_text?>" class="baimg" onclick="thumb_img_click(this)">
                <span class="photo_infos"><?=$img_width?>x<?=$img_height?> - <?=WWW_CROSSMAP?><?=$img_view_url?></span>
                <img id="expand-jump-<?=$idx?>" class="basic__img" src="<?=$main_img?>" alt="<?=$title_text?>" />
	        </a>


		        <a href="javascript:;" class="expand__close" onclick="img_view_close(this)"></a>
		        <a href="javascript:img_view_change('<?=$val['row_num']+1?>');" title="다음이미지" class="ommbtn omm_next">&gt;</a>
		        <a href="javascript:img_view_change('<?=$val['row_num']-1?>');" title="이전이미지" class="ommbtn omm_pre">&lt;</a>
		        <div class="omm_con">
		            <div class="omgg_left"><a href="<?=$img_view_url?>" title="<?=$title_text?>"><img class="image--large" src="<?=$main_img?>" alt="<?=$title_text?>" /></a></div>
                    <div class="omgg_right">
                        <ul class="omgg_ul1">
                            <li class="omm_tit"><a href="<?=$img_view_url?>"><?=$val['title']?></a></li>
                            <li class="omm_txt"><strong><?=$content_name?></strong><?=$img_width?>x<?=$img_height?><span>|</span><?=$img_type[$img_mime]?><span>
                        </ul>
                        <div class="omm_imm_list">
                        <ul>
                        <?  for ($z=0;$z<$relation_count;$z++) {
                                $key = rand(0, $max_rand_num);
                                $val2 = $list[$key];
                                switch ($val2['content_type']) {
                                    case '1': $img_view_url2 = '/web/news/news_view/'.$val2['idx'];     break;
                                    case '2': $img_view_url2 = '/web/news/column_view/'.$val2['idx'];	break;
                                    case '3': $img_view_url2 = '/m/life/life_view/'.$val2['idx'];	     break;
                                }
                                $alt_text2 =     $val2['title'];
                                if($val2['category_name']!='')	$alt_text2.= ' - '.$val2['category_name'];


                        ?>



                            <li class="imms"><a href="<?=$img_view_url2?>"><img src="<?=$val2['main_img']?>" class="smalls" title="<?=$alt_text2?>"></a></li>

                        <?  }?>
                        </ul>
                        </div>



<?
		}
    }


    echo '|||||'.$more_list;

} else {
    echo $result_code.'|||||이미지 가져오기에 실패했습니다.';

}
?>

