Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Znowu tworzenie miniaturek., Witam
MateuszS
post
Post #1





Grupa: Zarejestrowani
Postów: 1 429
Pomógł: 195
Dołączył: 6.10.2008
Skąd: Kraków/Tomaszów Lubelski

Ostrzeżenie: (0%)
-----


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
  • Go to the top of the page
    +Quote Post

    Posty w temacie


    Reply to this topicStart new topic
    2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
    0 Zarejestrowanych:

     



    RSS Aktualny czas: 4.10.2025 - 05:50