tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
0
ZUGRIFFE
2086
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    flokli flokli ist offline Mitglied Gold
    Registriert seit
    Mar 2006
    Ort
    bei Mainz
    Beiträge
    100
    Hallo, ich will für mein Fotoalbum ein "Bilderstapel-Feature" einbauen, wo man die ersten 2(3,4) Bilder eines Verzeichnisses leicht gedreht übereinander angezeigt bekommt.
    (Ähnlich wie im WMP 10, Bild im Anhang).

    Dazu benutze ich die GD-Lib (v2.0)

    Das Problem: Es werden beliebige Bildtypen (GIF/JPG/PNG) ausgelesen, das Endbild soll aber transparent sein (Es soll halt ein transparenter Hintergrund sein), PHP liefert aber einen schwarzen Hintergrund, obwohl ich imagesavealpha() verwende und das Bild als PNG ausgebe. Außerdem wird nur das letze (oberste) Bild angezeigt->Es überlagert mit dem schwarzen Hintergrund die anderen Bilder...

    Hier der Code (in Auszügen):
    config_photogallery.php
    PHP-Code:
    $config_photogallery['width']="150";
    $config_photogallery['pilestep']="5"
    rotate.php
    PHP-Code:
    <?php

    include_once "config_photogallery.php";
    include_once 
    "functions.inc.php";

    function 
    picpile($pictures$step '')
    {
        global 
    $config_photogallery;
        if (
    $step == "")
        {
            
    $step $config_photogallery['pilestep'];
        }
        
    $pictures explode("|"$pictures); //Bilder in Array

        
    $angle "0"//Aktueller Drehwinkel, wird in den Schleifen geändert

        
    $p['pile'] = imagecreatetruecolor($config_photogallery['width'], $config_photogallery['width']);
        
    imagesavealpha ($p['pile'], true);

        foreach(
    $pictures as $key => $value)
        {
            
    $imagesize[$key] = getimagesize($value);
            switch (
    $imagesize[$key][2])
            {
                case 
    1:
                    
    $imagesize[$key]['type'] = "GIF";
                    break;
                case 
    2:
                    
    $imagesize[$key]['type'] = "JPEG";
                    break;
                case 
    3:
                    
    $imagesize[$key]['type'] = "PNG";
                    break;
                default:
                    
    $imagesize[$key]['type'] = null;
            } 
    // switch
            
    $p[$key] = call_user_func("imagecreatefrom" $imagesize[$key]['type'], $value); //Bild einlesen
            
    imagesavealpha ($p[$key], true);
            
    $p['temp'] = imagecreatetruecolor($config_photogallery['width'], $config_photogallery['width']); //Temp-Bild mit Pilegröße erstellen, dieses wird auf den vorhandenen Stapel draufkopiert
            
    imagesavealpha ($p['temp'], true);

            
    $breite_thumb $config_photogallery['width'] / 2;
            
    $hoehe_thumb = ($config_photogallery['width'] / 2) * ($imagesize[$key][1] / $imagesize[$key][0]);
            
    $x_thumb $config_photogallery['width'] / 4;
            
    $y_thumb = ($config_photogallery['width'] - $hoehe_thumb) / 2;

            
    imagecopyresampled($p['temp'], $p[$key], $x_thumb$y_thumb00$breite_thumb$hoehe_thumb$imagesize[$key][0], $imagesize[$key][1]);
            
    $p['temp'] = ImageRotate($p['temp'], $angle, -1);
            
    imagesavealpha ($p['temp'], true);

            
    imagecopy($p['pile'], $p['temp'], 0000imagesx($p['temp']), imagesy($p['temp']));
            
    $angle += $step//aktuellen Drehwinkel vergrößern
            
    imagedestroy($p[$key]);
            
    imagedestroy($p['temp']);
        }
        
    header("Content-type: image/png");
        
    imagepng($p['pile']);
    }

    picpile("pics/Windows Vista/Wallpapers/Garden.jpg|pics/Windows Vista/Wallpapers/Tukan.jpg")
    ?>
    Das Ergebnis kann man sich unter http://diesv.de/v1/photogallery/rotate.php ansehen.

    Ich habe die "zu stapelnden Bilder", wie es aussehen sollte und wie es aussieht angehängt.
    Ich weiß, dass die Bilder momentan mit den Einstellungen kaum sichtbar und zu klein sind, dass werde ich ändern

    Ich hoffe, jemand kennt dieses Problem und weiß eine Lösung...

    PS: PHP 4
    Angehängte Grafiken Angehängte Grafiken     
    Geändert von flokli (23.07.06 um 21:42 Uhr)
     
    Why is Ajax so smart?
    -You can kill your server without a reload.

Ähnliche Themen

  1. Transparenz in *.tga ?
    Von soyo im Forum Photoshop
    Antworten: 0
    Letzter Beitrag: 09.02.07, 13:09
  2. transparenz
    Von Luminus im Forum Photoshop
    Antworten: 9
    Letzter Beitrag: 15.04.04, 19:35
  3. Transparenz
    Von derschatten im Forum Cinema 4D
    Antworten: 2
    Letzter Beitrag: 10.04.03, 11:53
  4. transparenz
    Von Matherix im Forum Photoshop
    Antworten: 3
    Letzter Beitrag: 14.02.03, 22:01
  5. transparenz
    Von Matherix im Forum Photoshop
    Antworten: 5
    Letzter Beitrag: 01.02.03, 13:56