| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /bpkd_29052026/assets/images/default/ |
Upload File : |
<?php
/**
* Placeholder Image Generator
* Usage: <img src="assets/images/default/placeholder.php?type=carousel&text=Gambar+Tidak+Tersedia">
*/
// Set content type
header('Content-Type: image/svg+xml');
// Get parameters
$type = isset($_GET['type']) ? $_GET['type'] : 'default';
$text = isset($_GET['text']) ? urldecode($_GET['text']) : 'No Image';
$width = isset($_GET['width']) ? (int)$_GET['width'] : 1200;
$height = isset($_GET['height']) ? (int)$_GET['height'] : 800;
// Define colors based on type
switch ($type) {
case 'carousel':
$bgColor = 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)';
$textColor = '#ffffff';
break;
case 'article':
$bgColor = 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)';
$textColor = '#ffffff';
break;
case 'page':
$bgColor = 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)';
$textColor = '#ffffff';
break;
case 'profile':
$bgColor = 'linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)';
$textColor = '#ffffff';
break;
default:
$bgColor = 'linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)';
$textColor = '#666666';
}
// Create SVG
$svg = '<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="' . $width . '" height="' . $height . '" viewBox="0 0 ' . $width . ' ' . $height . '">
<defs>
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
' . getGradientStops($bgColor) . '
</linearGradient>
</defs>
<rect width="' . $width . '" height="' . $height . '" fill="url(#grad)"/>
<!-- Pattern overlay -->
<pattern id="pattern" patternUnits="userSpaceOnUse" width="40" height="40" patternTransform="rotate(45)">
<rect width="20" height="20" fill="rgba(255,255,255,0.1)"/>
</pattern>
<rect width="' . $width . '" height="' . $height . '" fill="url(#pattern)"/>
<!-- Icon -->
<g transform="translate(' . ($width/2 - 50) . ', ' . ($height/2 - 70) . ')">
' . getIcon($type) . '
</g>
<!-- Text -->
<text x="50%" y="' . ($height/2 + 40) . '" font-family="Arial, sans-serif" font-size="24" font-weight="bold" fill="' . $textColor . '" text-anchor="middle" dominant-baseline="middle">
' . htmlspecialchars($text) . '
</text>
</svg>';
echo $svg;
// Helper function to parse gradient colors
function getGradientStops($gradient) {
if (strpos($gradient, 'linear-gradient') === false) {
return '<stop offset="0%" stop-color="' . $gradient . '"/><stop offset="100%" stop-color="' . $gradient . '"/>';
}
preg_match_all('/#[a-f0-9]{6}|rgba?\([^)]+\)/i', $gradient, $matches);
$colors = $matches[0];
if (count($colors) >= 2) {
return '<stop offset="0%" stop-color="' . $colors[0] . '"/><stop offset="100%" stop-color="' . $colors[1] . '"/>';
}
return '<stop offset="0%" stop-color="#cccccc"/><stop offset="100%" stop-color="#999999"/>';
}
// Helper function to get icon based on type
function getIcon($type) {
switch ($type) {
case 'carousel':
return '<circle cx="50" cy="50" r="40" fill="rgba(255,255,255,0.3)"/>
<rect x="35" y="40" width="30" height="30" rx="5" fill="white"/>
<circle cx="70" cy="60" r="5" fill="white"/>
<circle cx="80" cy="40" r="5" fill="white"/>';
case 'article':
return '<rect x="20" y="20" width="60" height="60" rx="5" fill="rgba(255,255,255,0.3)"/>
<line x1="30" y1="35" x2="70" y2="35" stroke="white" stroke-width="3"/>
<line x1="30" y1="45" x2="70" y2="45" stroke="white" stroke-width="3"/>
<line x1="30" y1="55" x2="55" y2="55" stroke="white" stroke-width="3"/>';
case 'page':
return '<rect x="20" y="20" width="60" height="70" rx="3" fill="rgba(255,255,255,0.3)"/>
<line x1="30" y1="30" x2="70" y2="30" stroke="white" stroke-width="3"/>
<line x1="30" y1="40" x2="60" y2="40" stroke="white" stroke-width="3"/>
<line x1="30" y1="50" x2="50" y2="50" stroke="white" stroke-width="3"/>';
case 'profile':
return '<circle cx="50" cy="35" r="20" fill="rgba(255,255,255,0.3)"/>
<circle cx="50" cy="85" r="30" fill="rgba(255,255,255,0.3)"/>';
default:
return '<rect x="20" y="20" width="60" height="60" rx="5" fill="rgba(255,255,255,0.3)"/>
<line x1="30" y1="30" x2="70" y2="70" stroke="white" stroke-width="3"/>
<line x1="70" y1="30" x2="30" y2="70" stroke="white" stroke-width="3"/>';
}
}
?>