Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [php]wyswietlenie zdjec
Forum PHP.pl > Forum > Przedszkole
Lonas
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. ?>
skowron-line
zmiana nazwy to moze rename i policz ile jest fotek w folderze +1
Lonas
pytam jak to zrobić technicznie.. to chyba logiczne że trzeba je zliczyć i +1

to chyba bedzie dobra metoda do wyswietlenia :
  1. <?php
  2. // !== nie istniał w wersji wcześniejszej niż 4.0.0-RC2
  3.  
  4. if ($handle = opendir('/path/to/files')) {
  5.  echo "Directory handle: $handlen";
  6.  echo "Files:n";
  7.  
  8.  /* To jest poprawna metoda */
  9.  while (false !== ($file = readdir($handle))) {
  10.  echo "$filen";
  11.  }
  12.  
  13.  /* To jest ZŁA metoda */
  14.  while ($file = readdir($handle)) {
  15.  echo "$filen";
  16.  }
  17.  
  18.  closedir($handle);
  19. }
  20. ?>


a co z kopiowaniem adresu pliku po klikcnieciu w niego
skowron-line
Kod
to chyba logiczne że trzeba je zliczyć i +1

nie dla wszystkich.ale dobrze ze wiesz

ja bym zawartosc pliku wrzucil do tablicy
tylko trzeba uwzgeldnic cos takiego
..
.
erix
Cytat
http://mojserwer/galeria/1.jpg zostanie skopiowany do schowka ?

chyba tylko w IE :/
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.