actors / poster images

This commit is contained in:
Lars Behrends
2025-10-17 13:45:57 +02:00
parent 929ee43001
commit f4c1cfc164
6 changed files with 195 additions and 54 deletions

View File

@@ -34,6 +34,30 @@ class AdultController extends Controller
// Get adult videos with pagination and search
$adultVideos = AdultVideo::getAllWithPagination($this->pdo, $page, $perPage, $search);
// Process metadata to extract local image paths for template compatibility
foreach ($adultVideos as &$video) {
if (!empty($video['metadata'])) {
$metadata = json_decode($video['metadata'], true);
// Use local cover path if available, otherwise fall back to original URL
if (!empty($metadata['local_cover_path'])) {
$video['poster_url'] = '/public/images/'.$metadata['local_cover_path'];
} elseif (!empty($metadata['cover_url'])) {
$video['poster_url'] = $metadata['cover_url'];
}
// Add other local paths if needed
if (!empty($metadata['local_screenshot_path'])) {
$video['screenshot_url'] = $metadata['local_screenshot_path'];
}
// Add actors data if available
if (!empty($metadata['actors'])) {
$video['actors'] = $metadata['actors'];
}
}
}
// Get total count for pagination
$totalCount = AdultVideo::getTotalCount($this->pdo, $search);
@@ -82,6 +106,17 @@ class AdultController extends Controller
// Decode metadata for display
$metadata = json_decode($adultVideo['metadata'], true);
// Add local image paths to the video data for template compatibility
if (!empty($metadata['local_cover_path'])) {
$adultVideo['poster_url'] = '/public/images/'.$metadata['local_cover_path'];
} elseif (!empty($metadata['cover_url'])) {
$adultVideo['poster_url'] = $metadata['cover_url'];
}
if (!empty($metadata['local_screenshot_path'])) {
$adultVideo['screenshot_url'] = '/public/images/'.$metadata['local_screenshot_path'];
}
return $this->view->render($response, 'adult/show.twig', [
'title' => $adultVideo['title'],
'movie' => $adultVideo, // Keep same variable name for template compatibility