37 lines
715 B
PHP
37 lines
715 B
PHP
<?php
|
|
session_start();
|
|
require_once '../includes/db_hr.php';
|
|
|
|
if (!isset($_SESSION['user_id'])) {
|
|
http_response_code(401);
|
|
exit;
|
|
}
|
|
|
|
if (!$pdo_hr) {
|
|
http_response_code(500);
|
|
exit;
|
|
}
|
|
|
|
$cid = $_GET['cid'] ?? '';
|
|
if (empty($cid)) {
|
|
http_response_code(400);
|
|
exit;
|
|
}
|
|
|
|
try {
|
|
$stmt = $pdo_hr->prepare("SELECT HR_IMAGE FROM hr_person WHERE HR_CID = ?");
|
|
$stmt->execute([$cid]);
|
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if ($result && !empty($result['HR_IMAGE'])) {
|
|
// Output image
|
|
header("Content-Type: image/jpeg");
|
|
echo $result['HR_IMAGE'];
|
|
} else {
|
|
http_response_code(404);
|
|
}
|
|
} catch (PDOException $e) {
|
|
http_response_code(500);
|
|
}
|
|
?>
|