Ankündigung

Einklappen
Keine Ankündigung bisher.

Bilder Import System

Einklappen

Neue Werbung 2019

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

  • Bilder Import System

    hallo
    Ich habe mir hier was zusammen gebastelt.
    PHP-Code:
    <?php


    $imgfile 
    ="web-groß.jpg";

    $to="bild";


    $thumbsize=150;
    header('Content-type: image/jpeg');
    list(
    $width$height) = getimagesize($imgfile);
    $imgratio=$width/$height;
    if (
    $imgratio>1){
    $newwidth $thumbsize;
    $newheight $thumbsize/$imgratio;}
    else{
    $newheight $thumbsize;
    $newwidth $thumbsize*$imgratio;}
    $thumb ImageCreateTrueColor($newwidth,$newheight);
    $source imagecreatefromjpeg($imgfile);
    imagecopyresized($thumb$source0000$newwidth$newheight$width$height);
    imagejpeg($thumb,"bild_klein/thumb_$imgfile.jpg",100);


    if (!
    copy($imgfile$to."/".$imgfile)) 

    print (
    "failed to copy $imgfile...
    n"
    );

    ?>
    Das erstellt aus dem $imgfile ="web-groß.jpg"; ein kleines bild und speichert das und speichert das orginal bild in einem andern Ordner. Jetzt möchte aber nicht immer sagen mit welchen bild er das machen soll. Sondern er soll das mit allen bildern aus einem ordner machen.
    Doch leider Klappt das nicht so wie ich möchte.
    Ich hatte es mal so versucht:

    PHP-Code:
    $verz dir("import");
    echo 
    "Handle: ".$verz->handle."
    "
    ;
    echo 
    "Pfad: ".$verz->path."
    "
    ;
    while(
    $entry=$verz->read()) {
    echo 
    $entry."
    "
    ;
    }
    $verz->close();

    $imgfile ="import/"$entry
    doch das klappt leider nicht so.
    Wie müsste ich das den machen das es kalppt?

    Philipp

  • #2
    Guckst du: http://www.phptt.de/showschnipsel.php?kat=6&id=37

    Gruß
    phpfan

    Kommentar


    • #3
      PHP-Code:
      <?php

      $home_pfad 
      ".";

      $dh opendir($home_pfad);
      while(
      $datei readdir($dh))
      {     if(
      $datei !== "" && $datei !== "." && $datei !== ".."){
      if (
      eregi(".jpg",$datei)) {

              
              if(
      is_file($home_pfad."/".$datei)){


      $imgfile =$datei;

      $to="bild";


      $thumbsize=150;
      header('Content-type: image/jpeg');
      list(
      $width$height) = getimagesize($imgfile);
      $imgratio=$width/$height;
      if (
      $imgratio>1){
      $newwidth $thumbsize;
      $newheight $thumbsize/$imgratio;}
      else{
      $newheight $thumbsize;
      $newwidth $thumbsize*$imgratio;}
      $thumb ImageCreateTrueColor($newwidth,$newheight);
      $source imagecreatefromjpeg($imgfile);
      imagecopyresized($thumb$source0000$newwidth$newheight$width$height);
      imagejpeg($thumb,"bild_klein/thumb_$imgfile.jpg",100);


      if (!
      copy($imgfile$to."/".$imgfile)) 

      print (
      "failed to copy $imgfile...
      n"
      ); 



              }
          }
      }
      }
      ?>
      ungetestet und lustlos gschrieben.
      [url=http://m7s.de/100.html]Klick mich
      [img]http://m7s.de/100.png[/img][/URL]

      [img]http://www3.stefanmaier.com/SONSTIGES/FSL/b-day.jpg[/img]

      Kommentar


      • #4
        Hey,
        so vielen danke genau das brauche ich.

        Philipp

        Kommentar

        Lädt...
        X