Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Upload zdjeć wraz ze zmiana proporcji
Szendci
post 19.01.2009, 17:51:22
Post #1





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 9.11.2008

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


Witam!
Proszę o pomoc bo mam już dosyć zabawy z tym, poniżej co wykombinowałem:


  1. <?php
  2. $upload_url=&#092;"fotki/\";
  3.   $data=getdate();
  4.   $dzisiaj='P'.$data['year'].''.$data['mon'].''.$data['mday'].''.$data['hours'].''.$data['minutes'].''.$data['seconds'].'_';
  5.   $temp_name = $_FILES['userfile']['tmp_name'];
  6.   $file_name = $_FILES['userfile']['name'];
  7.   $file_type = $_FILES['userfile']['type'];
  8.   $file_size = $_FILES['userfile']['size'];
  9.   $result    = $_FILES['userfile']['error'];
  10.  
  11.      if( $file_type!= 'image/pjpeg'){
  12.             $message= &#092;"Program akceptowalny tylko .JPG lub .JPEG\";
  13.                }
  14.    $nazwa_docelowa=$dzisiaj.$file_name;
  15.    $file_url  = $upload_url.$nazwa_docelowa;
  16.    //File Name Check
  17.    if ( $file_name ==&#092;"\") {
  18.        $message = &#092;"Zła nazwa pliku.\";
  19.  
  20.    }
  21.    //File Size Check
  22.  
  23.    if ( $file_size > 1000000) {
  24.        $message = &#092;"Plik musi być mniejszy niż 1 MB.\";
  25.  
  26.    }
  27.  
  28.  
  29.  $img = imagecreatefromjpeg($temp_name);
  30.  $width=600;
  31.  $sW = imagesx($img);
  32.  $sH = imagesy($img);
  33.  $wsp = $width/$sW;
  34.  $height=$sH*$wsp;
  35.  $tempImg = imagecreatetruecolor($width, $height);
  36.  imagecopyresampled($upload_url, $temp_name, 0, 0, 0, 0, $width, $height, $sW, $sH);
  37.  
  38.  imagejpeg($tempImg, $file_name);
  39.  
  40.  
  41.   $zapytanie = mysql_query(&#092;"INSERT INTO `\".$prefix.\"fotki` VALUES (NULL, '\".$file_url.\"', '\".$dzis.\"', '')\");
  42. ?>

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in C:\xampp\htdocs\blog\include\admin\fotki.php on line 37

Fotka nie jest w odpowiednim folderze, nie ma zmienionej nazwy i w dodatku jest czarna biggrin.gif

Może ktoś pomóc co jest źle?


PS. Temat do usunięcia już sobie poradziłem.

Ten post edytował Szendci 20.01.2009, 09:51:19
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 13:49