Bild drehen

Slater

Erfahrenes Mitglied
Hy, ich habe ein Bildergalerie script gemacht.
Dabei passt es mir die Bilder auf eine vorgegebene Breite an (img-function).
Da es aber hochformatige und querformatige Bilder gibt will ich es automatisieren, dass es mir das bild dreht (Es werden alle Bilder im Querformat upgeloadet -> Format wird in der mysql tabelle gespeicher [format] Querformat oder Hochformat).
Aber wie geht diese function für das drehen beim Hochformat?

PHP:
<?php
....
$Anfrage="SELECT * FROM Bilder";
$result = mysql_query($Anfrage,$Verbindung);
 while ($ausgabe = mysql_fetch_array ($result))
 {
print ("
if (ausgabe[Format] == Querformat)
{
$thumb1 = new thumb();
$thumb1->create("$ausgabe[Bild]", 300, 0, 0);
$thumb1->savetofile("$ausgabe[Bild]", 60); // Bild speichern
$thumb1->clear();
}
else {}

if (ausgabe[Format] == Hochformat)
{
$thumb1 = new thumb();
$thumb1->create("$ausgabe[Bild]", 200, 0, 0);
$thumb1->savetofile("$ausgabe[Bild]", 60); // Bild speichern
$thumb1->clear();
}
else {}
");
}
?>

mfg Slater
 
PHP:
<?php
$result = mysql_query("SELECT * FROM Bilder",$Verbindung);
while ($ausgabe = mysql_fetch_array ($result)) {
    if ($ausgabe["Format"] == "Querformat") {
        $thumb1 = new thumb();
        $thumb1->create($ausgabe["Bild"], 300, 0, 0);
        $thumb1->savetofile($ausgabe["Bild"], 60);
        $thumb1->clear();
    } else {
        // [...]
    }
    if ($ausgabe["Format"] == "Hochformat") {
        $thumb1 = new thumb();
        $thumb1->create($ausgabe["Bild"], 200, 0, 0);
        $thumb1->savetofile($ausgabe["Bild"], 60);
        $thumb1->clear();
    } else {
        // [...]
    }
}
?>

Das sollte schon ehr gehen :)
 
Merci,
habe eigentlich noch nicht auf die korrekte Form geschaut :rolleyes:
Aber meine Frage ist, wie kann ich das Querformatbild drehen (90°)?

thanx slater
 
Moin,

meinst du sowas:

imagerotate()

(PHP 4 >= 4.3.0)


imagerotate -- Rotate an image with a given angle
Description
ressource imagerotate ( resource src_im, float angle, int bgd_color)


Rotates the src_im image using a given angle in degree. bgd_color specifies the color of the uncovered zone after the rotation.


oder schaust mal nach CSS-Filtern (nur MS)


Gruß

Tex
 
Danke,
jetzt weiss ich warum imagerotate bei mir nicht geht. habe php 4.2.3 :(

Wie geht den das mit den css-filtern??
 
mmh,

weiß jetzt nicht auf anhieb ob es überhaupt möglich ist das mit CSS
zu realisieren. Einfach mal bei selfhtml vorbeischauen.
Müsste ich selber auch machen.



Oder PHP - Version updaten ;-))



Tex
 
Zurück