테스트 사이트 - 개발 중인 베타 버전입니다

페이스북처럼 회원리스트를 보여주고 쪽지보내기 기능을하려는데요 채택완료

카플 4년 전 조회 1,769

while ($rank_mb2 = sql_fetch_array($result_rank2)){ $rank_list2[] = $rank_mb2;

//echo $myphoto=mb_photo($rank_list2[$k][mb_id]); $profile_rank_path2 = "../data/member/profile/{$rank_list2[$k][mb_id]}.jpg";

$photo = array(); $photo_filename='';

$dest_path = G5_DATA_PATH.'/member/profile/'; $dest_url = G5_DATA_URL.'/member/profile/'; $permit = array('jpg','gif','png');

    foreach($permit as $val) {         $photo_name = $rank_list2[$k][mb_id].'.'.$val;         $photo_file = $dest_path.$photo_name;

        // 사진이 있다면 변수 넘김         if(file_exists($photo_file)) {             $photo[$k] = '';             //img-responsive

            $frid[$k]=$rank_list2[$k][mb_id];             $rank2[$k]="{$photo[$k]}";             $k=$k+1;         }     } }

 

배열이랑 사진파일이 jpg 인지 png인지 구별해서 넣어줘야하는데 잘안되느데 아시는분 계시나요??

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트
e
4년 전

</p>

<p>$img_data = getimagesize($dest_url);</p>

<p>switch($img_data[2]) {</p>

<p>  case 1: $ext = gif; break;</p>

<p>  case 2: $ext = jpg; break;</p>

<p>  case 3: $ext = gif; break;</p>

<p>  default: $ext = "";</p>

<p>}</p>

<p>

아래 참조

https://lighthouse2.tistory.com/entry/PHP-getimagesize-%ED%95%A8%EC%88%98

 

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인