ich brauche ein wenig Hilfe bei php.
Ich möchte meine Bilder auf meiner Website so haben wie in folgendem.
Ich habe dafür auch schon einen Code, von dem Ersteller bekommen, jedoch funkt er nicht richtig.
Ich stelle es jetzt mal hier rein.
Code:
<?php define("URL", "http://vobsworld.de/picture/"); define("MAX", 1500); $curl = explode('/', $_SERVER['REQUEST_URI']); $img = (!empty($curl[1])) ? $curl[1] : ''; if(!empty($img) && !strstr($img, 'screen/screen')){ $data = getimagesize('./screen/'.$img); if($data[0] > MAX){header("Location: ".URL."screen/".$img);} $imgok = true; } ?> <html> <head> <style type="text/css"> body{ margin: 0; background: url(http://codepen.cybrox.eu/restransfer/mooning.png) left top repeat #999; font-family: Arial; } img { display: block; position: absolute; max-width: 95%; top: 50%; left: 50%; <?php echo 'margin: -'.floor($data[1]/2).'px 0 0 -'.floor($data[0]/2).'px;'; ?> border: 1px solid #999; box-shadow: 1px 1px 4px #333; -webkit-box-shadow: 1px 1px 4px #333; -moz-box-shadow: 1px 1px 4px #333; -o-box-shadow: 1px 1px 4px #333; } </style> <title><?php echo $img; ?></title> </head> <body> <?php if($imgok){ echo '<img src="'.URL.'screen/'.$img.'" alt="" />'; } else { echo '<center><h1>404</h1></center>'; } ?> </body> </html>
Eine .htaccess Datei habe ich auch erstellt. Sie sieht wie folgt aus.
Code:
RewriteEngine on RewriteCond {index.php} !-d RewriteCond {index.php} !-f RewriteRule . index.php [L]