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
     
    Start new topic
    Odpowiedzi (1 - 5)
    peter13135
    post
    Post #2





    Grupa: Zarejestrowani
    Postów: 1 447
    Pomógł: 191
    Dołączył: 26.03.2008

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


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

    - niema pliku, lub brak praw dostępu do pliku

    pozostałe błędy wydają sie mieć tą samą przyczynę
    Go to the top of the page
    +Quote Post
    MateuszS
    post
    Post #3





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

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


    Problem rozwiazany, przepraszam.
    Go to the top of the page
    +Quote Post
    marcio
    post
    Post #4





    Grupa: Zarejestrowani
    Postów: 2 291
    Pomógł: 156
    Dołączył: 23.09.2007
    Skąd: ITALY-MILAN

    Ostrzeżenie: (10%)
    X----


    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/
    Go to the top of the page
    +Quote Post
    patryk9200
    post
    Post #5





    Grupa: Zarejestrowani
    Postów: 319
    Pomógł: 4
    Dołączył: 7.02.2009
    Skąd: pless

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


    Sprawdź czy zdjęcie istnieje i jest w dobrym katalogu i chmod'y folderów.... czy zdjęcie się przesyła?
    Go to the top of the page
    +Quote Post
    Ziom73
    post
    Post #6





    Grupa: Zarejestrowani
    Postów: 140
    Pomógł: 1
    Dołączył: 8.04.2009
    Skąd: Polanica Zdrój | Poznań | Wrocław

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


    Autor już napisał, że problem został już rozwiązany!
    Go to the top of the page
    +Quote Post

    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: 23.08.2025 - 08:22