Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Znowu tworzenie miniaturek.
Forum PHP.pl > Forum > Przedszkole
MateuszS
Witam, chce zrobic edycje newsa, i mam tam edycje obrazka, obrazka rozmiar chce zmniejszyc do 700x.. x700 i miniaturke 150x.. ..x150 do folderu miniaturki. Jednak wypluwa kupe bledow zwiazanych z funkcja.


  • [/list]
  •   $aspect_ratio = $img_width / $img_height;
  •  
  •   if ( ($img_width > $max_dimension) || ($img_height > $max_dimension) )
  •   {
  •       if ( $img_width > $img_height )
  •       {
  •           $new_width = $max_dimension;
  •           $new_height = $new_width / $aspect_ratio;
  •       }
  •       elseif ( $img_width < $img_height )
  •       {
  •           $new_height = $max_dimension;
  •           $new_width = $new_height * $aspect_ratio;
  •       }
  •       elseif ( $img_width == $img_height )
  •       {
  •           $new_width = $max_dimension;
  •           $new_height = $max_dimension;
  •       }
  •       else { echo "Error reading image size."; return FALSE; }
  •   }
  •   else { $new_width = $img_width; $new_height = $img_height; }
  •  
  •  
  •   $new_width = intval($new_width);
  •   $new_height = intval($new_height);
  •  
  •   $thumbnail = imagecreatetruecolor($new_width,$new_height);
  •  
  •  
  •   if ( strpos($source_file,".gif") ) { $img_source = imagecreatefromgif($source_file); }
  •   if ( (strpos($source_file,".jpg")) || (strpos($source_file,".jpeg")) )
  •   { $img_source = imagecreatefromjpeg($source_file); }
  •   if ( strpos($source_file,".bmp") ) { $img_source = imagecreatefromwbmp($source_file); }
  •   if ( strpos($source_file,".png") ) { $img_source = imagecreatefrompng($source_file); }
  •  
  •  
  •   imagecopyresampled($thumbnail, $img_source, 0, 0, 0, 0, $new_width, $new_height, $img_width, $img_height);
  •   imagejpeg( $thumbnail, $destination_file, 100 );
  •  
  •  
  •   imagedestroy($img_source);
  •   imagedestroy($thumbnail);
  • ?>

    [/list]
  •   $aspect_ratio = $img_width / $img_height;
  •  
  •   if ( ($img_width > $max_dimension) || ($img_height > $max_dimension) )
  •   {
  •       if ( $img_width > $img_height )
  •       {
  •           $new_width = $max_dimension;
  •           $new_height = $new_width / $aspect_ratio;
  •       }
  •       elseif ( $img_width < $img_height )
  •       {
  •           $new_height = $max_dimension;
  •           $new_width = $new_height * $aspect_ratio;
  •       }
  •       elseif ( $img_width == $img_height )
  •       {
  •           $new_width = $max_dimension;
  •           $new_height = $max_dimension;
  •       }
  •       else { echo "Error reading image size."; return FALSE; }
  •   }
  •   else { $new_width = $img_width; $new_height = $img_height; }
  •  
  •  
  •   $new_width = intval($new_width);
  •   $new_height = intval($new_height);
  •  
  •   $thumbnail = imagecreatetruecolor($new_width,$new_height);
  •  
  •  
  •   if ( strpos($source_file,".gif") ) { $img_source = imagecreatefromgif($source_file); }
  •   if ( (strpos($source_file,".jpg")) || (strpos($source_file,".jpeg")) )
  •   { $img_source = imagecreatefromjpeg($source_file); }
  •   if ( strpos($source_file,".bmp") ) { $img_source = imagecreatefromwbmp($source_file); }
  •   if ( strpos($source_file,".png") ) { $img_source = imagecreatefrompng($source_file); }
  •  
  •  
  •   imagecopyresampled($thumbnail, $img_source, 0, 0, 0, 0, $new_width, $new_height, $img_width, $img_height);
  •   imagejpeg( $thumbnail, $destination_file, 100 );
  •  
  •  
  •   imagedestroy($img_source);
  •   imagedestroy($thumbnail);
  • ?>

    [/list]
    [PHP] Kod
    Warning: unlink(zdjecia/1248383496/miniaturki/Jellyfish.jpg) [function.unlink]: No such file or directory in C:\xampp\htdocs\wycieczka\panel.php on line 1008

    Warning: unlink(zdjecia/1248383496/Jellyfish.jpg) [function.unlink]: No such file or directory in C:\xampp\htdocs\wycieczka\panel.php on line 1009

    Warning: getimagesize(zdjecia/1248383496/Chrysanthemum.jpg) [function.getimagesize]: failed to open stream: No such file or directory in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 4

    Warning: Division by zero in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 5

    Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 32

    Warning: imagecreatefromjpeg(zdjecia/1248383496/Chrysanthemum.jpg) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 37

    Warning: imagecopyresampled(): supplied argument is not a valid Image resource in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 42

    Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 43

    Warning: imagedestroy(): supplied argument is not a valid Image resource in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 46

    Warning: imagedestroy(): supplied argument is not a valid Image resource in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 47

    Warning: getimagesize(zdjecia/1248383496/Chrysanthemum.jpg) [function.getimagesize]: failed to open stream: No such file or directory in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 4

    Warning: Division by zero in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 5

    Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 32

    Warning: imagecreatefromjpeg(zdjecia/1248383496/Chrysanthemum.jpg) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 37

    Warning: imagecopyresampled(): supplied argument is not a valid Image resource in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 42

    Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 43

    Warning: imagedestroy(): supplied argument is not a valid Image resource in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 46

    Warning: imagedestroy(): supplied argument is not a valid Image resource in C:\xampp\htdocs\wycieczka\miniaturka_obrazki.php on line 47
  • marcio
    No to jak wiesz ze znowu to nie warto poszukac?

    1. <?php
    2. $newsource = 'zdjecia/'.$pan[1].'/'.$_FILES['glowny']['name'];
    3. ?>

    Wychodzi na to ze ta sciezka jest bledna moze dodaj / albo ./ przed zdjecia/
    patryk9200
    Sprawdź czy zdjęcie istnieje i jest w dobrym katalogu i chmod'y folderów.... czy zdjęcie się przesyła?
    Ziom73
    Autor już napisał, że problem został już rozwiązany!
    To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
    Invision Power Board © 2001-2025 Invision Power Services, Inc.