![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/public_html/ |
<?php
/**
* Check track image for "THE CIRCLE THAT BREATHES"
*/
require_once 'config/database.php';
$pdo = getDBConnection();
// Find the track
$stmt = $pdo->prepare("
SELECT
id,
title,
task_id,
image_url,
metadata,
is_public,
status
FROM music_tracks
WHERE title LIKE '%CIRCLE THAT BREATHES%'
OR title LIKE '%circle that breathes%'
ORDER BY id DESC
LIMIT 10
");
$stmt->execute();
$tracks = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo "<h1>Track Image Check for 'THE CIRCLE THAT BREATHES'</h1>";
echo "<pre>";
if (empty($tracks)) {
echo "ā No tracks found with that title\n";
} else {
foreach ($tracks as $track) {
echo "\n=== Track ID: {$track['id']} ===\n";
echo "Title: {$track['title']}\n";
echo "Task ID: {$track['task_id']}\n";
echo "Status: {$track['status']}\n";
echo "Is Public: " . ($track['is_public'] ? 'Yes' : 'No') . "\n";
echo "Image URL in DB: " . ($track['image_url'] ?: 'NULL/EMPTY') . "\n";
// Check metadata
if (!empty($track['metadata'])) {
$metadata = json_decode($track['metadata'], true);
if (isset($metadata['image_url'])) {
echo "Image URL in Metadata: {$metadata['image_url']}\n";
}
if (isset($metadata['cover_url'])) {
echo "Cover URL in Metadata: {$metadata['cover_url']}\n";
}
// Check task_results in metadata
if (isset($metadata['task_results']) && is_array($metadata['task_results'])) {
foreach ($metadata['task_results'] as $result) {
if (isset($result['image_url'])) {
echo "Image URL in task_results: {$result['image_url']}\n";
}
}
}
}
// Try to get image from API based on task_id pattern
// From callback log: image_url format is https://musicfile.api.box/{task_id}.jpeg
$apiImageUrl = "https://musicfile.api.box/{$track['task_id']}.jpeg";
echo "Potential API Image URL: {$apiImageUrl}\n";
// Try to download and save it
if (empty($track['image_url'])) {
echo "\nš Attempting to download image from API...\n";
$ch = curl_init($apiImageUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$imageData = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode === 200 && $imageData) {
echo "ā
Successfully downloaded image (" . strlen($imageData) . " bytes)\n";
// Save to uploads/track_covers/
$uploadsDir = $_SERVER['DOCUMENT_ROOT'] . '/uploads/track_covers/';
if (!is_dir($uploadsDir)) {
mkdir($uploadsDir, 0755, true);
}
$filename = "track_{$track['id']}_" . time() . ".jpeg";
$filepath = $uploadsDir . $filename;
if (file_put_contents($filepath, $imageData)) {
$imageUrl = "/uploads/track_covers/{$filename}";
echo "ā
Saved to: {$imageUrl}\n";
// Update database
$updateStmt = $pdo->prepare("UPDATE music_tracks SET image_url = ? WHERE id = ?");
if ($updateStmt->execute([$imageUrl, $track['id']])) {
echo "ā
Database updated with image_url: {$imageUrl}\n";
} else {
echo "ā Failed to update database\n";
}
} else {
echo "ā Failed to save file\n";
}
} else {
echo "ā Failed to download (HTTP {$httpCode})\n";
}
}
// Check if file exists
if (!empty($track['image_url'])) {
$imagePath = $_SERVER['DOCUMENT_ROOT'] . $track['image_url'];
if (file_exists($imagePath)) {
echo "ā
File EXISTS at: {$imagePath}\n";
echo " File size: " . filesize($imagePath) . " bytes\n";
} else {
echo "ā File DOES NOT EXIST at: {$imagePath}\n";
// Try alternative paths
$altPath = ltrim($track['image_url'], '/');
if (file_exists($altPath)) {
echo "ā
File EXISTS at alternative path: {$altPath}\n";
}
}
}
// Check uploads directory for this track
$uploadsDir = $_SERVER['DOCUMENT_ROOT'] . '/uploads/track_covers/';
if (is_dir($uploadsDir)) {
$pattern = $uploadsDir . "track_{$track['id']}_*";
$files = glob($pattern);
if (!empty($files)) {
echo "š Found files in uploads/track_covers/:\n";
foreach ($files as $file) {
echo " - " . basename($file) . " (" . filesize($file) . " bytes)\n";
}
} else {
echo "š No files found in uploads/track_covers/ for track_{$track['id']}_*\n";
}
}
echo "\n";
}
}
echo "</pre>";
?>