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
 
Start new topic
Odpowiedzi (1 - 4)
skowron-line
post
Post #2





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


zmiana nazwy to moze rename i policz ile jest fotek w folderze +1


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post
Lonas
post
Post #3





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

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


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

Ten post edytował Lonas 17.10.2006, 14:25:05


--------------------
Go to the top of the page
+Quote Post
skowron-line
post
Post #4





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


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
..
.


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post
erix
post
Post #5





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Cytat
http://mojserwer/galeria/1.jpg zostanie skopiowany do schowka ?

chyba tylko w IE :/


--------------------

ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW!
Go to the top of the page
+Quote Post

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 Aktualny czas: 20.08.2025 - 10:13