회원이미지 블러오기 다시 질문드립니다. ㅠ 채택완료
Copy
// 회원이미지 경로
$mb_img_url = G5_DATA_URL.'/member_image/'.substr($member[mb_id],0,2).'/'.$member[mb_id].'.gif';
if(file_exists($mb_img_url)) {
$profile_path="/img/no_profile.gif";
}else{
$profile_path=$mb_img_url;
}
<img src="<?php echo $profile_path ?>" alt="회원이미지">
이렇게 하니 이미지가 있을때 정상으로 불러옵니다.
이미지가 없을때 (디렉토리 & 파일) /img/no_profile.gif 이게 불러오게 해야 되는데
잘 안되네요 ㅠㅠ
선생님분들 한수 부탁드립니다.
답변 1개
채택된 답변
+20 포인트
2년 전
if(file_exists($mb_img_url)) {
$profile_path=$mb_img_url;
}else{
$profile_path="/img/no_profile.gif";
}
거꾸로 하셔어요;;
로그인 후 평가할 수 있습니다
답변에 대한 댓글 5개
2년 전
if (file_exists($_SERVER['DOCUMENT_ROOT'] . $mb_img_url)) {
$profile_path = $mb_img_url;
} else {
$profile_path = '/img/no_profile.gif';
이렇게 해보세요
$profile_path = $mb_img_url;
} else {
$profile_path = '/img/no_profile.gif';
이렇게 해보세요
2년 전
// 회원이미지 경로
$mb_img_path = G5_DATA_PATH.'/member_image/'.substr($member[mb_id],0,2).'/'.$member[mb_id].'.gif';
$mb_img_url = G5_DATA_URL.'/member_image/'.substr($member[mb_id],0,2).'/'.$member[mb_id].'.gif';
if(is_file($mb_img_path)) {
$profile_path=$mb_img_url;
}else{
$profile_path="/img/no_profile.gif";
}
이렇게 해서 해결했습니다. 감사합니다. ^^
$mb_img_path = G5_DATA_PATH.'/member_image/'.substr($member[mb_id],0,2).'/'.$member[mb_id].'.gif';
$mb_img_url = G5_DATA_URL.'/member_image/'.substr($member[mb_id],0,2).'/'.$member[mb_id].'.gif';
if(is_file($mb_img_path)) {
$profile_path=$mb_img_url;
}else{
$profile_path="/img/no_profile.gif";
}
이렇게 해서 해결했습니다. 감사합니다. ^^
2년 전
G5_DATA_URL.‘/member_image/’.substr($member[mb_id],0,2).‘/’.$member[mb_id].‘.gif’;
if(file_exists($mb_img_url)) { $profile_path=$mb_img_url; }else{ $profile_path=“/img/no_profile.gif”; }<img src=“<?php echo $profile_path ?>” alt=“회원이미지”>
이런식으로
if(file_exists($mb_img_url)) { $profile_path=$mb_img_url; }else{ $profile_path=“/img/no_profile.gif”; }<img src=“<?php echo $profile_path ?>” alt=“회원이미지”>
이런식으로
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인