Initial commit: 교육 프로젝트 배포
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* 테스트: get_comments.php profile_image 경로 계산 검증
|
||||
* 브라우저에서 /edu/_tmp_profile_image_test.php 로 접근
|
||||
*/
|
||||
$profileDir = __DIR__ . '/img/profile/';
|
||||
$defaultIcon = '/edu/img/ico/ico_user.svg';
|
||||
|
||||
// 실제 img/profile/ 디렉토리에 있는 파일 목록
|
||||
$files = glob($profileDir . '*.png') ?: [];
|
||||
|
||||
echo '<h2>profile_image 경로 계산 테스트</h2>';
|
||||
echo '<p><b>img/profile/ 디렉토리:</b> ' . $profileDir . '</p>';
|
||||
echo '<p><b>디렉토리 존재:</b> ' . (is_dir($profileDir) ? '✅ 존재' : '❌ 없음') . '</p>';
|
||||
echo '<hr>';
|
||||
|
||||
if (empty($files)) {
|
||||
echo '<p>⚠️ 업로드된 프로필 이미지 없음 → 기본 아이콘 표시 예정</p>';
|
||||
} else {
|
||||
echo '<h3>업로드된 프로필 이미지 목록</h3>';
|
||||
echo '<table border="1" cellpadding="8">';
|
||||
echo '<tr><th>파일명</th><th>member_id</th><th>sys_comp_code</th><th>경로 계산</th><th>이미지 미리보기</th></tr>';
|
||||
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 '<tr>';
|
||||
echo '<td>' . htmlspecialchars(basename($f)) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($memberId) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($sysCompCode) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($url) . '</td>';
|
||||
echo '<td><img src="' . htmlspecialchars($url) . '" style="width:40px;height:40px;border-radius:50%;object-fit:cover;"></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
echo '<hr>';
|
||||
echo '<h3>경로 계산 시뮬레이션</h3>';
|
||||
|
||||
// 현재 세션 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 '<p><b>세션 member_id:</b> ' . htmlspecialchars($memberId) . '</p>';
|
||||
echo '<p><b>세션 sys_comp_code:</b> ' . htmlspecialchars($sysCompCode) . '</p>';
|
||||
echo '<p><b>예상 파일 경로:</b> ' . htmlspecialchars($testFilePath) . '</p>';
|
||||
echo '<p><b>파일 존재:</b> ' . (file_exists($testFilePath) ? '✅ 있음' : '❌ 없음 → 기본 아이콘 사용') . '</p>';
|
||||
echo '<p><b>최종 profile_image 값:</b> ' . htmlspecialchars($testUrl) . '</p>';
|
||||
echo '<p><b>이미지 미리보기:</b> <img src="' . htmlspecialchars($testUrl) . '" style="width:40px;height:40px;border-radius:50%;border:1px solid #999;object-fit:cover;"></p>';
|
||||
|
||||
echo '<hr>';
|
||||
echo '<h3>get_comments.php 내부 경로 계산 확인</h3>';
|
||||
// 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 '<p><b>get_comments.php __DIR__:</b> /edu/bbs/api/</p>';
|
||||
echo '<p><b>../../img/profile 실제 경로:</b> ' . htmlspecialchars($resolvedPath) . '</p>';
|
||||
echo '<p><b>현재 파일 기준 동일 경로:</b> ' . htmlspecialchars(realpath($profileDir) ?: $profileDir) . '</p>';
|
||||
$pathMatch = (realpath($resolvedPath) === realpath($profileDir));
|
||||
echo '<p><b>경로 일치 여부:</b> ' . ($pathMatch ? '✅ 일치' : '⚠️ 불일치 - 확인 필요') . '</p>';
|
||||
Reference in New Issue
Block a user