exec+imagemagick

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • exec+imagemagick

    hi da exec unter php nix zurückgibt ich aber mir über

    PHP-Code:
    exec(identify -verbose ....) 
    Informationen über ein Bild hlen will, wollte ich mal fragen ob jemand von euch nen befehl kennt imagemagick auszuführen und in php etwas zurückzubekommen.

  • #2
    PHP-Code:
    <?php

        exec
    ('identify ' $sFile$output$retval);

    ?>
    schaud dir einfach an, was in den variablen steht. Mußt aber in $sFile den Dateinamen reinschreiben...

    weitere Infos wie immer im Manual:
    http://de3.php.net/manual/de/function.exec.php

    Kommentar


    • #3
      hi also ich habe es nu wie beschrieben ausgeführt, nu leider mit dem ergebniss,

      Array ( )

      154


      Als erstes habe ich mir den array ausgegeben , ich dachte dass er in $output die ausgabe macht. doch anscheinend nicht .

      laut manual ist es doch so , oder habe ich dass falsch kapiert ?

      Kommentar


      • #4
        also...

        erstmal ein kleines Skript, das shell kommandos absetzt...

        bitte so nicht auf dem Server installieren!!!!

        PHP-Code:
        <?php
        echo '<form method="post">

        <textarea style="height: 100px; width: 400px; font-family: courier; 
        font-size: 12px;" name="command">'
        .$_POST['command'].'</textarea>
        <input type="submit" accesskey="s">
        </form>'
        ;

        if (isset(
        $_POST['command']))
        {
            
        $output = array();
            
        exec($_POST['command'], $output$retval);
            
            echo 
        'output<br>
            <div stlye="background-color: #ddd; border: 1px; solid; width: 500px; 
        padding: 10px;">
            <pre>'
        ;
            
        print_r($output);
            echo 
        '</pre>
            </div>
            '
        ;
            
            echo 
        'retval<br>
            <div stlye="background-color: #ddd; border: 1px; solid; width: 500px; 
        padding: 10px;">
            <pre>'
        ;
            
        print_r($retval);
            echo 
        '</pre>
            </div>
            '
        ;
        }
        ?>
        wenn ich das jetzt so auf ein bild anwende:
        identify -verbose images/bild.jpg

        bekomme ich folgende ausgabe:
        Code:
        output
        
        Array
        (
            [0] => Image: images/bild.jpg
            [1] =>   Format: JPEG (Joint Photographic Experts Group JFIF format)
            [2] =>   Geometry: 350x243
            [3] =>   Class: DirectClass
            [4] =>   Type: true color
            [5] =>   Depth: 8 bits-per-pixel component
            [6] =>   Colors: 21483
            [7] =>   Profile-APP12: 15 bytes
            [8] =>   Resolution: 100x100 pixels
            [9] =>   Filesize: 20928b
            [10] =>   Interlace: None
            [11] =>   Background Color: white
            [12] =>   Border Color: #dfdfdf
            [13] =>   Matte Color: grey74
            [14] =>   Iterations: 0
            [15] =>   Compression: JPEG
            [16] =>   signature: 941d4eead8b81763da3733f0ce8114883d76ffbaba67e372076f043a8d9937e0
            [17] =>   Tainted: False
            [18] =>   User Time: 0.0u
            [19] =>   Elapsed Time: 0:01
        )
        
        retval
        
        0
        EDIT:
        Zeilenumbrüche by wotan
        Zuletzt geändert von Wotan; 02.09.2004, 09:15.

        Kommentar


        • #5
          hi danke, bei mir lag es daran dass ich die einfachen anfürhungsstriche firekt hinter verbose gemacht hatte, anstatt noch ein leertzeichen zu hinterlegen.

          Kommentar

          Lädt...
          X