Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]wyswietlenie zdjec
Lonas
post
Post #1





Grupa: Zarejestrowani
Postów: 576
Pomógł: 14
Dołączył: 9.11.2005

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


Mam taki skrypt który wrzuca mi zdjecia na serwer - pytanie moje jest takie : co w nim zmienic zeby zdjecia wrzucane na serwer mialy kolejne numery - nazwa bylaby zmieniana -

drugie pytanie jak poźniej wyswietlic te zdjecia ? minatury ,

Czy da sie zrobic tak że jak klikne na minaturke to adres obrazka czyli np
http://mojserwer/galeria/1.jpg zostanie skopiowany do schowka ?
Teraz ctrl v i adres moge sobie gdzies wkleic


  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/min');
  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. $handle->image_resize  = true;
  18. $handle->image_ratio_y = true;
  19. $handle->image_x = 200;
  20.  
  21. // now, we start the upload 'process'. That is, to copy the uploaded file
  22. // from its temporary location to the wanted location
  23. // It could be something like $handle->Process('/home/www/my_uploads/');
  24. $handle->Process('./galeria/min');
  25.  
  26. $handle->image_resize  = true;
  27. $handle->image_ratio_y = true;
  28. $handle->image_x = 600;
  29.  
  30. // now, we start the upload 'process'. That is, to copy the uploaded file
  31. // from its temporary location to the wanted location
  32. // It could be something like $handle->Process('/home/www/my_uploads/');
  33. $handle->Process('./galeria/big');
  34.  
  35.  
  36. // we check if everything went OK
  37. if ($handle->processed) {
  38. // everything was fine !
  39. echo '<fieldset>';
  40. echo ' <legend>file uploaded with success</legend>';
  41. echo ' <img src="test/' . $handle->file_dst_name . '" />';
  42. $info = getimagesize($handle->file_dst_pathname);
  43. echo ' <p>' . $info['mime'] . ' &nbsp;-&nbsp; ' . $info[0] . ' x ' . $info[1] .' &nbsp;-&nbsp; ' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB</p>';
  44. echo ' link to the file just uploaded: <a href="test/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a><br/>';
  45. echo '</fieldset>';
  46. } else {
  47. // one error occured
  48. echo '<fieldset>';
  49. echo ' <legend>file not uploaded to the wanted location</legend>';
  50. echo ' Error: ' . $handle->error . '';
  51. echo '</fieldset>';
  52. }
  53.  
  54. } else {
  55. // if we're here, the upload file failed for some reasons
  56. // i.e. the server didn't receive the file
  57. echo '<fieldset>';
  58. echo ' <legend>file not uploaded on the server</legend>';
  59. echo ' Error: ' . $handle->error . '';
  60. echo '</fieldset>';
  61. }
  62. ?>


Ten post edytował Lonas 17.10.2006, 13:56:12
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: 15.09.2025 - 01:32