I am making thumbnail viewer with serveral sources, however I can not make one file.
<? for ($i=0; $i<count($list); $i++) { ?
$m++;
//1. get from uploaded thumbnail
$data_path = $g4[path].'/data/file/$bo_table';
$thumb_path = $data_path.'/thumb';
$image = $list[$i][file][0][file];
$img=$data_path. "/".$image;
$thumb = $thumb_path. "/". $list[$i][wr_id];
if ( file_exists($thumb) ) {
return $img_path = $thumb;
}
//2. get from linked
$data = $list[$i]['wr_content'] ;
if ($list[$i][file][1][file]) {
$file = $list[$i][file][1][path] .'/'. $list[$i][file][1][file];
}else if ($list[$i][file][0][file]) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
}
if (preg_match("/\.(jp[e]?g|gif|png|btm)$/i", $file) && file_exists($file)) {
$img_path = $file ;
//3. get from body's link
}else{
preg_match('/img.*?src=(.*?) /i', $data, $aaa);
$img_path = $aaa[1];
$del_str_arr = array('"', "'");
$img_path = str_replace($del_str_arr, "", $img_path);
$img_path = trim($img_path);
print_r($i."-5::=> ".$img_path."</br>");
}
$subj_len = $z2[width] ? $z2[width] : 35 ;
$data_len = $z2[data_width] ? $z2[data_width] : 300 ;
$del_str_arr = array("===", "---");
$data = str_replace($del_str_arr, "", $data);
$subj = cut_str(trim(strip_tags($list[$i]['subject'])),$subj_len,'..');
$data = cut_str(trim(strip_tags($data)),$data_len,'...');
?>
Please make this "one-If-structure".