profile_image 경로 계산 테스트'; echo '

img/profile/ 디렉토리: ' . $profileDir . '

'; echo '

디렉토리 존재: ' . (is_dir($profileDir) ? '✅ 존재' : '❌ 없음') . '

'; echo '
'; if (empty($files)) { echo '

⚠️ 업로드된 프로필 이미지 없음 → 기본 아이콘 표시 예정

'; } else { echo '

업로드된 프로필 이미지 목록

'; echo ''; echo ''; foreach ($files as $f) { $basename = basename($f, '.png'); $parts = explode('_', $basename, 2); $memberId = $parts[0] ?? '?'; $sysCompCode = $parts[1] ?? '?'; $url = '/edu/img/profile/' . basename($f); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
파일명member_idsys_comp_code경로 계산이미지 미리보기
' . htmlspecialchars(basename($f)) . '' . htmlspecialchars($memberId) . '' . htmlspecialchars($sysCompCode) . '' . htmlspecialchars($url) . '
'; } echo '
'; echo '

경로 계산 시뮬레이션

'; // 현재 세션 member_id / sys_comp_code 기준도 확인 session_start(); $memberId = $_SESSION['member_id'] ?? 'B24014'; $sysCompCode = $_SESSION['sys_comp_code'] ?? '30'; $testFilePath = $profileDir . $memberId . '_' . $sysCompCode . '.png'; $testUrl = file_exists($testFilePath) ? '/edu/img/profile/' . $memberId . '_' . $sysCompCode . '.png' : $defaultIcon; echo '

세션 member_id: ' . htmlspecialchars($memberId) . '

'; echo '

세션 sys_comp_code: ' . htmlspecialchars($sysCompCode) . '

'; echo '

예상 파일 경로: ' . htmlspecialchars($testFilePath) . '

'; echo '

파일 존재: ' . (file_exists($testFilePath) ? '✅ 있음' : '❌ 없음 → 기본 아이콘 사용') . '

'; echo '

최종 profile_image 값: ' . htmlspecialchars($testUrl) . '

'; echo '

이미지 미리보기:

'; echo '
'; echo '

get_comments.php 내부 경로 계산 확인

'; // get_comments.php 안에서 __DIR__은 /edu/bbs/api/ // 파일 탐색 경로: __DIR__ . '/../../img/profile/...' // = /edu/bbs/api/../../img/profile/ = /edu/img/profile/ $apiDir = __DIR__ . '/bbs/api'; $resolvedPath = realpath($apiDir . '/../../img/profile') ?: ($apiDir . '/../../img/profile'); echo '

get_comments.php __DIR__: /edu/bbs/api/

'; echo '

../../img/profile 실제 경로: ' . htmlspecialchars($resolvedPath) . '

'; echo '

현재 파일 기준 동일 경로: ' . htmlspecialchars(realpath($profileDir) ?: $profileDir) . '

'; $pathMatch = (realpath($resolvedPath) === realpath($profileDir)); echo '

경로 일치 여부: ' . ($pathMatch ? '✅ 일치' : '⚠️ 불일치 - 확인 필요') . '

';