';
$html.=$_tagk;
$html.='';
} else {
$html.='';
$html.=$_tagk;
$html.='';
}
endfor;
return $html;
}
// 첨부파일 리스트 갯수 추출 함수
function _getAttachNum($upload,$mod){
global $table;
$attach = getArrayString($upload);
$attach_file_num=0;// 첨부파일 수량
$hidden_file_num=0; // 숨김파일(다운로드 방지) 수량
foreach($attach['data'] as $val)
{
$U = getUidData($table['s_upload'],$val);
if($U['fileonly']==1) $attach_file_num++; // 전체 첨부파일 수량 증가
if($U['hidden']==1) $hidden_file_num++; // 숨김파일 수량 증가
}
$down_file_num=$attach_file_num-$hidden_file_num; // 다운로드 가능한 첨부파일
$result=array();
$result['modify']=$attach_file_num;
$result['view']=$down_file_num;
return $result[$mod];
}
// 첨부파일 리스트 추출 함수 (전체)
/*
$parent_data : 해당 포스트의 row 배열
$mod : upload or modal ==> 실제 업로드 모드 와 모달을 띄워서 본문에 삽입용도로 쓰거나
*/
function _getAttachFileList($parent_data,$mod,$type,$device){
global $table;
$upload=$parent_data['upload'];
$featured_img_uid=$parent_data['featured_img'];// 대표이미지 uid
$featured_video_uid=$parent_data['featured_video'];// 대표비디오 uid
$featured_audio_uid=$parent_data['featured_audio'];// 대표오디오 uid
if($type=='file') $sql='type=1 and hidden=0';
else if($type=='photo') $sql='type=2 and hidden=0';
else if($type=='audio') $sql='type=4 and hidden=0';
else if($type=='video') $sql='type=5 and hidden=0';
else if($type=='doc') $sql='type=6 and hidden=0';
else if($type=='zip') $sql='type=7 and hidden=0';
else $sql='type=1';
$attach = getArrayString($upload);
$uid_q='(';
foreach($attach['data'] as $uid)
{
$uid_q.='uid='.$uid.' or ';
}
$uid_q=substr($uid_q,0,-4).')';
$sql=$sql.' and '.$uid_q;
$RCD=getDbArray($table['s_upload'],$sql,'*','gid','asc','',1);
$html='';
while($R=db_fetch_array($RCD)){
$U=getUidData($table['s_upload'],$R['uid']);
if ($device =='mobile') {
if($type=='file') $html.=_getAttachFile_m($U,$mod,$featured_img_uid);
else if($type=='photo') $html.=_getAttachPhoto_m($U,$mod,$featured_img_uid);
else if($type=='audio') $html.=_getAttachAudio_m($U,$mod,$featured_audio_uid);
else if($type=='video') $html.=_getAttachVideo_m($U,$mod,$featured_video_uid);
else $html.=_getAttachFile_m($U,$mod,$featured_img_uid);;
} else {
if($type=='file') $html.=_getAttachFile($U,$mod,$featured_img_uid);
else if($type=='photo') $html.=_getAttachPhoto($U,$mod,$featured_img_uid);
else if($type=='audio') $html.=_getAttachAudio($U,$mod,$featured_audio_uid);
else if($type=='video') $html.=_getAttachVideo($U,$mod,$featured_video_uid);
else $html.=_getAttachFile($U,$mod,$featured_img_uid);;
}
}
return $html;
}
function _getAttachObjectArray($parent_data,$type){
global $table;
$upload=$parent_data['upload'];
$featured_img_uid=$parent_data['featured_img'];// 대표이미지 uid
$featured_video_uid=$parent_data['featured_video'];// 대표비디오 uid
$featured_audio_uid=$parent_data['featured_audio'];// 대표오디오 uid
if($type=='file') $sql='type=1 and hidden=0';
else if($type=='photo') $sql='type=2 and hidden=0';
else if($type=='audio') $sql='type=4 and hidden=0';
else if($type=='video') $sql='type=5 and hidden=0';
else if($type=='doc') $sql='type=6 and hidden=0';
else if($type=='zip') $sql='type=7 and hidden=0';
else $sql='type=1';
$attachArray = [];
$attach = getArrayString($upload);
$uid_q='(';
foreach($attach['data'] as $uid)
{
$uid_q.='uid='.$uid.' or ';
}
$uid_q=substr($uid_q,0,-4).')';
$sql=$sql.' and '.$uid_q;
$RCD=getDbArray($table['s_upload'],$sql,'*','gid','asc','',1);
// Loop through query and push results into $someArray;
// while ($R = mysqli_fetch_assoc($query)) {
while($R=db_fetch_array($RCD)){
$U=getUidData($table['s_upload'],$R['uid']);
$src = $U['src'];
array_push($attachArray, [
'src' => $src,
'w' => $U['width'],
'h' => $U['height'],
'title' => $U['caption']
]);
}
return $attachArray;
}
// 첨부파일 리스트 추출 함수 (데스크탑,사진)
function _getAttachPhoto($R,$mod,$featured_img_uid) {
global $g,$r;
$fileName=explode('.',$R['name']);
$file_name=$fileName[0]; // 파일명만 분리
$caption=$R['caption']?$R['caption']:$file_name;
$img_origin=$R['src'];
$img_origin_size=$R['width'].'x'.$R['height'];
$thumb_list=getPreviewResize($R['src'],'c'); // 미리보기 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.)
$thumb_modal=getPreviewResize($R['src'],'q'); // 정보수정 모달용 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.)
$insert_text='';
$html='';
$html.='
';
$html.='
'.getSizeFormat($R['size'],2).'
'.getSizeFormat($R['size'],2).'