bildervorschau brauche da nen script

dickup

Cadet 3rd Year
Registriert
Sep. 2006
Beiträge
57
hi

ich habe da ne kleine php page und wollte jetzt bilder auf die page setzen doch das sind soviele das man da 100 jahre scrollen muss bis man am ende ist.

ich dachte da an sowas wie bei google man hat nen kleines bild als vorschau und dann wenn man draufklick wird es groß bzw ein neues fenster mit dem bild öffnet sich

wie muss ich das einbinden?? bzw habt ihr da nen script??

ich hoffe ihr könnt mir da weiterhelfen


danke!


mfg dickup
 
Ich hab eins, welches diese Vorschaubilder "Thumbnails" erstellt. Es ist aber nicht besonders gut und es gibt 100 andere im Internet die besser sind :)
Kanns aber ja mal trotzdem zeigen:

Code:
<?php

###############################
## Thumbcreation script V 0.9b
## by eXtiQ     05/31/2006
## last edit     10/15/2006
###############################



/*
*    Usage:
*    Example: thumb.php?bild=%Filename to an image%
*    This will output an 100px width and propotional height sized image.
*    You can use wether .gif , .jpg or .png
*/

if(isset($_GET['picture']))                                                                     ## Check, if $_GET Attribute is set
{
    $img = htmlspecialchars($_GET['picture']);
    if (!get_magic_quotes_gpc())
    {
        addslashes($img);
    }

    if (trim(substr($img,0,7)) == "http://" or trim(substr($img,0,6)) == "ftp://")
    {
        DIE("Denied");
    }

    $type = getimagesize($img);
    switch($type[2])                                                                             ## Switch the Imagetype, written in index 2
    {
        case 1 :     $picture = imagecreatefromgif($img); $typ = 1;                 break;            ## gif
        case 2 :    $picture = imagecreatefromjpeg($img); $typ = 2;             break;            ## jpg
        case 3 :    $picture = imagecreatefrompng($img); $typ = 3;                 break;            ## png

        default : echo "Not a JPG/GIF/PNG file";
    }

    $width = imagesx($picture);                                                                 ## get width of the image
    $height = imagesy($picture);                                                                ## get height of the image
    $nwidth = 100;                                                                                ## define new width
    $nheight = round(($height / $width) * 100);                                                    ## define new height
    $thumb = imagecreate($nwidth, $nheight);                                                    ##    create new empty image
    imagecopyresized($thumb,$picture,0,0,0,0,$nwidth,$nheight,$width,$height);                    ## copy thumbnail into new image

    ## Send header information to the browser ##
    header ("HTTP/1.1 200 OK", true);
    header ("Date: ". gmdate("D, d M Y H:i:s GTM"), true);
    header ("Server: Apache/2.0.55", true);
    header ("Accept-Ranges: bytes", true);

    switch($typ)
    {
        case 1 :
        {
            header ("Content-Type: image/gif", true);
            imagegif($thumb,"",100);
            break;
        }

        case 2 :
        {
            header ("Content-Type: image/jpg", true);
            imagejpeg($thumb,"",100);
            break;
        }

        case 3 :
        {
            header ("Content-Type: image/png", true);
            imagejpeg($thumb,"",100);
            break;
        }

        default : echo "Error: No Filetype";
    }


    imagedestroy($thumb);
}
?>
einfach beim Bild Attribut <img src="thumb.php?bild=bilddatei" /> .. die restliche Anzeige und so kannst du dir dann hoffentlich selber zusammenscripten mithilfe einer while Schleife o.ä. sofern du mit PHP arbeitest, ansonsten einfach wieder anfragen..
 
Zuletzt bearbeitet:
danke erstmal für das script ich werde das gleich mal austesten!

wo kann ich solche scripte im internet finden was muss ich bei google eingeben damit ich sowas rausgeschmissen bekomme und nicht auf irgendwelcen pornopages lande??



danke
 
Zurück
Oben