- Home
- Categorie
- Coding e Sistemistica
- PHP
- script immagini
-
script immagini
Salve a tutti ho bisogno di un aiuto per uno script che visualizzidelle immagini.
Vi spiego:
deve prendere da una cartella le prime venti immagini e stamparle a video,
poi con un bottone next aprire le venti consecutive e cosi via, se è possibile anche con un bottone back per le venti immagini precedenti
Chi mi puo aiutare o dare qualche indicazione gle ne sarei grato
Grazie
-
non puoi usare una delle tante gallery gratuite già pronte e al massimo te la personalizzi? Qui c'è un elenco di 4 pagine ben fornito:
http://php.html.it/script/lista/56/immagini-gallerie-e-slideshow/?ob=gd
-
@ienavr said:
non puoi usare una delle tante gallery gratuite già pronte e al massimo te la personalizzi? Qui c'è un elenco di 4 pagine ben fornito:
http://php.html.it/script/lista/56/immagini-gallerie-e-slideshow/?ob=gd
Ciao
ho trovato questo script che fa quasi al caso mio....
inserito in una cartella mi visualizza una immagine per volta e con i tasti next e back , vado avanti e indietro....
Avrei da fargli una modifica, ho bisogno di aprire 20 immagini per volta,
chi mi può aiutare????
Vi posto il codice
Grazie<?php // PHPSlideShow v0.4 written by Greg Lawler // v0.4 july 10 2001 - updated so that one script does multi directory slideshow // v0.3.5 july 5 2001 - added options for image/no image navigation // v0.3.4 april 19 2001 - added the "x of y" verbage (thanks patrick) // v0.3.3 january 9 2001 - added a bit of code so that the pics.txt file is not essential. // v0.3.1 september 29 2000 - added support for image buttons (thanks nicolas) // v0.3 september 12 2000 - added support for comments (thanks jonathan) // v0.2 august 28 2000 // // from http://www.zinkwazi.com/pages.php?page_name=scripts // Feel free to use/modify this little script // email me at [email protected] if you write any improvements and // want them included in the next version. // // IMPORTANT NOTE.... // if you want to send me a thankyou, starbucks coffee coupons are gladly accepted // (http://www.starbucks.com ;) // my address is: // attention: greg's phpslideshow // 801 alston road, santa barbara, ca 93108 usa // otherwise it's free. // // this script comes with no implied warranty. // // enjoy :) // greg // INSTALLATION INSTRUCTIONS // // ******* quick start // put this file in a directory that contains your images // the slideshow should now work... // // ******* how to add comments/descriptions to the slideshow // make a file (e.g. pics.txt) that contains the image names and descriptions // with each image name and description on a separate line separated by a semi colon. // an easy way to do this is type // ls *.jpg > pics.txt in linux or // dir *.jpg > pics.txt in dos - you will need edit this with notepad/vi to clean // out any extra stuff that dir puts in there and to add the semi colon and description. // the slideshow should now work including comments... // // ******* how to use one slideshow for multiple different directories of images // all you need to do to enable this is to call the script and pass it the directory // path. // eg http://your_url/phpslideshow.php?directory=dog_pics // eg http://your_url/phpslideshow.php?directory=cat_pics // eg http://your_url/phpslideshow.php?directory=extra/cat_pics // these three examples will run phpslideshow but each one will load a different // set of images located in the directories shown // // *** PLEASE use your own next and back images! i have included links to some on my // server so you can get up and running quickly... change them once your page is // working. // // EXAMPLE optional pics.txt FILE // // greg.jpg;Me // dog.JPEG;My dog John // cat; // tux.Jpg;My friend Tux // // NO BLANK LINES either! // as you can see, not all pics need a description but the ";" is a MUST! // point your browser at the script and voilla! // // ////////////////////////////////////////////////////////////////////////////// // variables, modify at will // $pic_info_file="pics.txt"; $header = "<a href=http://www.zinkwazi.com/pages.php?page_name=scripts>PHPSlideshow</a>"; $title = "PHPSlideshow"; // set this to true to display the image name below the image... $show_image_name = "false"; // change to true to display icons instead of text... // please use your own next and back images! $show_navigation_images = "true"; $back_image="http://www.izzyweb.it/img_articoli/freccia3.gif"; $next_image="http://www.izzyweb.it/img_articoli/freccia4.gif"; // // ////////////////////////////////////////////////////////////////////////////// // html stuff, replace with your sites include() header file e.g. // include("/home/httpd/html/header.php"); print "<html><head><title>$title</title>"; print "<style type=\"text/css\">"; print "body { font-family: verdana; font-size: 14px; }"; print "a { font-family: verdana; font-size: 14px; text-decoration: none}"; print "</style></head>"; print "<body>"; print "<center>"; print "<b>$header</b><br>"; // this part does the work and should need no editing if ($directory == "") $directory = "."; if ($show_navigation_images == "true") { $back_src = "<img src=$back_image alt=back border=0>"; $next_src = " <img src=$next_image alt=next border=0>"; } else { $back_src = "<b>Back</b>"; $next_src = "<b>Next</b>"; } if ( !file_exists("$directory/$pic_info_file")) { $dh = opendir( "$directory" ); while( $file = readdir( $dh ) ) { if ( ereg("jpg$",$file) || ereg("JPG$",$file) || ereg("jpeg$",$file) || ereg("JPEG$",$file) || ereg("jpeg$",$file) || ereg("JPEG$",$file) || ereg("gif$",$file) || ereg("GIF$",$file) || ereg("png$",$file) || ereg("PNG$",$file) || ereg("Jpg$",$file) || ereg("Jpeg$",$file) ) { $pic_info[] = $file; } } } else $pic_info=file("$directory/$pic_info_file"); $number_of_pics = count ($pic_info); if (($phpslideshow > $number_of_pics) || ($phpslideshow == $number_of_pics) || !$phpslideshow) $phpslideshow = '0'; $item = explode (";", $pic_info[$phpslideshow]); // print the description print "<b>$item[1]</b><br />"; $next = $phpslideshow + 1; if ($phpslideshow > 0 ) $back = $phpslideshow - 1; else $phpslideshow = '0'; // print the next and back links (note < and > to display <> in HTML) $last = $number_of_pics -1; if ($phpslideshow == $last) { print "<a href=$PHP_SELF?phpslideshow=$back&directory=$directory> $back_src</a> "; // comment out or delete the following line to remove the position message... print "$next of $number_of_pics"; print "<a href=$PHP_SELF?phpslideshow=$next&directory=$directory> $next_src</a><br>"; } elseif ($phpslideshow > 0 ) { print "<a href=$PHP_SELF?phpslideshow=$back&directory=$directory> $back_src</a> "; // comment out or delete the following line to remove the position message... print "$next of $number_of_pics "; print "<a href=$PHP_SELF?phpslideshow=$next&directory=$directory>"; print "$next_src</a><br>"; } else { // comment out or delete the following line to remove the position message... print "$next of $number_of_pics "; print "<a href=$PHP_SELF?phpslideshow=$next&directory=$directory>"; print "$next_src</a><br>"; } // print the image link print "<img src=\"$directory/$item[0]\"><br> <br>"; if ( $show_image_name == "true" ) { print "$item[0]"; } // the following line can be commented out if you want to display the full-size image // located in a directory called uncut in the same directory as the slideshow... // print "<a href=\"uncut/$item[0]\" target=new>This picture unscaled</a><br>"; // end of "work" // // html stuff, replace with your sites include() footer file // include("/home/httpd/html/footer.inc"); print "</CENTER></BODY></HTML>"; ?>
-
Nessuno mi puo dare una mano????
-
Ti avviso che non sono un esperto ma forse una soluzione veloce c'è
$ls = glob("directory_dove_hai_le_foto/*");
foreach ($ls as $filename) {
echo '<img src="'.$filename.'">;
}In pratica questo script ti stampa un "<img src" con il nome del file per ogni file presente nella directory, prova a documentarti sulla funzione glob per ampliare le funzionalità dello script.
Ciao
-
@Pennywise83 said:
Ti avviso che non sono un esperto ma forse una soluzione veloce c'è
$ls = glob("directory_dove_hai_le_foto/*");
foreach ($ls as $filename) {
echo '<img src="'.$filename.'">;
}In pratica questo script ti stampa un "<img src" con il nome del file per ogni file presente nella directory, prova a documentarti sulla funzione glob per ampliare le funzionalità dello script.
Ciao
Grazie Penny
la tua soluzione è semplice e funzionale
Grande