Hej-
Mam taki problem -

znalazłem skrypt ktory wrzuca mi zdjecia na serwer - dopisalem sobie kawalek który robi mi opis zdjecia -

z tym że mam problem żeby to połaczyć z klasą która uploaduje zdjecie - może ktoś wie jak to zrobić ? smile.gif

Oto kod dodanie opisu do zdjecia :

  1. <?php
  2. $img = ImageCreateFromJPEG("zdjecie.jpg");
  3. //pobranie rozmiarow
  4. $width = imagesx($img);
  5. $height = imagesy($img);
  6.  
  7. //zmniejszenie zdjecia
  8. $height_mini = $height * 0.85;
  9.  
  10. //utworznie nowego obrazka
  11. $img_mini = imagecreatetruecolor($width, $height);
  12.  
  13. //nadanie mu tla
  14. $kolor_bialy = imagecolorallocate($img_mini, 255, 255, 255);
  15. imagefilledrectangle($img_mini, 0, 0, $width, $height , $kolor_bialy);
  16.  
  17. //wklejenie pomniejszonego na nowy
  18. imagecopyresampled($img_mini, $img, 0, 15, 0, 0, $width , $height_mini, $width , $height);
  19.  
  20. //$zolty = ImageColorAllocate($img_mini, 255, 255, 0);
  21. //imagettftext($img_mini, 12, 0, 30, 20, 0, "verdana.TTF", "http://webmade.org");
  22.  
  23. //$czerwony=imagecolorallocate($img_mini, 255, 0, 0);
  24. imagestring($img_mini, 2, 2, 2, "Opis zdjecia", $czerwony);
  25. imagestring($img_mini, 2, 2, 175, "Fot. Jan Nowak", $czerwony);
  26.  
  27. imagejpeg($img_mini,"test2.jpg",100);
  28. ?>


a to kod klasy ( niecaly ) smile.gif

  1. <?php
  2. // ---------- IMAGE UPLOAD ----------
  3.  
  4. // we create an instance of the class, giving as argument the php object 
  5. // corresponding to the file field from the form
  6. // All the uploads are accessible from the php object $_FILES
  7. $handle = new Upload($_FILES['my_field']);
  8.  
  9. // then we check if the file has been uploaded properly
  10. // in its *temporary* location in the server (often, it is /tmp)
  11.  
  12. if ($handle->uploaded) {
  13. $handle->Process('./galeria/temp');
  14. // yes, the file is on the server
  15. // below are some example settings which can be used if the uploaded
  16. // file is an image.
  17.  
  18. $handle->image_resize = true;
  19. $handle->image_ratio_y = true;
  20. $handle->image_x = 600;
  21.  
  22. // now, we start the upload 'process'. That is, to copy the uploaded file
  23. // from its temporary location to the wanted location
  24. // It could be something like $handle->Process('/home/www/my_uploads/');
  25. $handle->Process('./galeria/big');
  26. ?>