Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 16

Discussione: Script phpslideshow...

  1. #1

    [freephp] Phpslideshow

    Ciao a tutti, innanzitutto mi congratulo con voi per il fantastico sito e forum dai quali sto aprrendendo parecchie cose.
    Vi scrivo ora per chiedervi:
    Ho scaricato uno script php (php slideshow), non avendo avuto molto a che fare con php non so come inserirlo nella pagina web, qualcuno di voi potrebbe aiutarmi per favore? Ve ne sarei grato.
    Grazie anticipatamente e tanti saluti a tutti!!!

  2. #2
    Utente di HTML.it L'avatar di thepooh
    Registrato dal
    Oct 2005
    Messaggi
    203
    Per prima cosa devi installarti php e apache, se vuoi anche un data base mysql.
    Sono tutti programmi free.
    Esistono parecchie guide sulle istallazioni, alcune sono postate nel regolamento

  3. #3

  4. #4
    Non riesco a capire coe si uploadano i file sul server locale...in che cartella metto il file phpslideshow.php?

  5. #5
    Ok, tutto risolto!!! Grazie mille ragazzi!!
    Ora però ho un piccolo problemino, ovvero:
    Quando carico il file nel browser si vede tutto, lo script funziona ma in alto mi dà i seguenti errori:

    Notice: Undefined index: phpslideshow in c:\programmi\easyphp1-8\www\phpslideshow.php on line 82

    Notice: Undefined index: browse in c:\programmi\easyphp1-8\www\phpslideshow.php on line 85

    Notice: Undefined index: auto in c:\programmi\easyphp1-8\www\phpslideshow.php on line 86

    Notice: Use of undefined constant exif - assumed 'exif' in c:\programmi\easyphp1-8\www\phpslideshow.php on line 174

    Notice: Undefined index: 1 in c:\programmi\easyphp1-8\www\phpslideshow.php on line 185


    Come posso correggerli?
    Non ne capisco tanto di php...
    Vi ringrazio anticipatamente per la risposta, spero non mi abbandoniate proprio adesso!!!

  6. #6

  7. #7
    <?php
    /*
    PHPSlideShow v0.9 written by Greg Lawler
    from http://www.zinkwazi.com/scripts

    v0.9.2 Aug 2005 - depricated $GLOBALS[] replaced with _GET
    v0.9.1 Aug 2005 - bug fixed to allow use on PHP < 4.3
    v0.9 June 2005 - major re-write, now template based
    v0.6.2 august 2002 - minor upgrade, added javascript notes
    v0.6.1 july 2002 - fixed special character bug.
    v0.6 july 2002 - added lots of formatting options and a security patch
    v0.5.1 march 2002 - minor bug fixes, reg exp fix...
    v0.5 march 2002 - osx path fix, page headings for multi dir, cleaner...
    v0.4 july 10 2001
    v0.3.5 july 5 2001
    v0.3.4 april 19 2001
    v0.3.3 january 9 2001
    v0.3.1 september 29 2000 - added support for image buttons
    v0.3 september 12 2000 - added support for comments
    v0.2 august 28 2000

    PHPSlideshow is relesed under the GPL
    See the license at http://www.gnu.org/licenses/gpl.txt
    Feel free to use/modify this little script

    IMPORTANT NOTE....
    if you want to send me a token of appreciation, i like coffee so
    anything from http://www.starbucks.com/card will be gladly accepted
    my address is:
    attention: greg lawler
    801 alston road, santa barbara, ca 93108 usa

    INSTALLATION: See README.txt

    enjoy
    greg
    */

    // NOTE: your phpslideshow.php script will work "out of the box" and
    // all layout and visual effects are controlled by the template.html file.
    // you can fine tune your slideshow by editing some of these settings.

    // number of images to display as thumbnails if a thumbnail directory exists
    // (note that this will be rounded down to an odd number for symmetry.)
    $thumb_row = 17;

    // name of file containing optional page headings
    $heading_info_file = "heading.txt";

    // file containing optional image descriptions
    $pic_info_file="pics.txt";

    // thumbnail directory name (no slashes needed)
    $thumbnail_dir = "thumbnails";

    // language text for various areas...
    $lang_back = "back";
    $lang_next = "next";
    $lang_of = "of";
    $lang_stop_slideshow = "stop slideshow";
    $lang_start_slideshow = "start slideshow";
    $lang_img_hover = "click for next image...";
    $lang_img_alt = "slideshow image";

    // automated slideshow options
    // remember that you need <META_REFRESH> in the <head> section of your html
    // AND the <AUTO_SLIDESHOW_LINK> tag in your page.
    // $delay is the number of seconds to pause between slides...
    $delay = 2;

    // sort images with newest or oldest on top. (this has no effect when pics.txt is used)
    // $sort_images = "oldest";
    $sort_images = "newest";

    // set to true to display navigation icons instead of text...
    $show_navigation_buttons = "false";
    $back_button = "/i/lround.gif";
    $next_button = "/i/rround.gif";

    ################################################## ##############################
    // grab the variables we want set for newer php version compatability
    $phpslideshow = $_GET['phpslideshow'];
    $directory = $_GET['directory'];
    $currentPic = $_GET['currentPic'];
    $browse = $_GET['browse'];
    $auto = $_GET['auto'];

    // check for platform dependent path info... (for windows and mac OSX)
    $path = empty($HTTP_SERVER_VARS['PATH_INFO'])?
    $HTTP_SERVER_VARS['PHP_SELF']:$HTTP_SERVER_VARS['PATH_INFO'];

    // this only works on php > 4.3, replacing with file()
    //if( file_exists( "template.html" ) ) $template = file_get_contents("template.html");
    if( file_exists( "template.html" ) ) $template = implode("", file('template.html'));
    else {
    echo "ERROR: Can't find the template.html file";
    exit;
    }

    // check that the user did not change the path...
    if (preg_match('\.\.|^/|\:', $directory)) {
    echo "ERROR: Your request contains an invalid path.

    Your directory may not contain .. or : or start with a /
    ";
    exit;
    }

    if (empty($directory)) $directory = ".";
    // if there is no $heading_info_file (see format above) set page heading here
    if ( !file_exists("$directory/$heading_info_file")) {
    $header = "PHPSlideshow by Greg Lawler";
    $title = "$header";
    }
    else {
    $heading_info = file("$directory/$heading_info_file");
    $header = "$heading_info[0]";
    $title = $header;
    }
    $template = str_replace("<SHOW_TITLE>",$title,$template);

    // image / text buttons
    if ($show_navigation_buttons == "true") {
    $back_src = "[img]$back_button[/img]";
    $next_src = "[img]$next_button[/img]";
    }
    else {
    $back_src = "$lang_back";
    $next_src = "$lang_next";
    }

    if ( !file_exists("$directory/$pic_info_file")) {
    $dh = opendir( "$directory" );
    $pic_info = array();
    $time_info = array();
    while( $file = readdir( $dh ) ) {
    // look for these file types....
    if (preg_match('/(jpg|jpeg|gif|png)$/i',$file)) {
    $time_info[] = filemtime("$directory/$file");
    $pic_info[] = $file;
    }
    }
    if ( $sort_images == "oldest" ) $sortorder = SORT_ASC;
    elseif ( $sort_images == "newest" ) $sortorder = SORT_DESC;
    array_multisort($time_info, $sortorder, $pic_info, SORT_ASC, $time_info);
    }
    else $pic_info=file("$directory/$pic_info_file");

    // begin messing with the array
    $number_pics = count ($pic_info);
    if (($currentPic > $number_pics)||($currentPic == $number_pics)||!$currentPic)
    $currentPic = '0';
    $item = explode (";", rtrim($pic_info[$currentPic]));
    $last = $number_pics - 1;
    $next = $currentPic + 1;
    if ($currentPic > 0 ) $back = $currentPic - 1;
    else $currentPic = "0";


    $blank = empty($item[1])?'':$item[1];

    if ($currentPic > 0 ) $nav=$back;
    else $nav=$last;
    $nav = "$back_src";
    $current_show = "$path?directory=$directory";
    $next_link = "$next_src";
    $template = str_replace("<CURRENT_SHOW>",$current_show,$templa te);
    $template = str_replace("<BACK>",$nav,$template);
    $template = str_replace("<NEXT>",$next_link,$template);
    $template = str_replace("<POSITION>","$next $lang_of $number_pics",$template);


    // {{{ ------- EXIF stuff

    //get comments from the EXIF data if available...
    if(extension_loaded(exif)) {
    $curr_image = "$directory/$item[0]";
    $all_exif = @exif_read_data($curr_image,0,true);
    $exifhtml = $all_exif['COMPUTED'];
    $comment = $all_exif['COMMENT'][0];
    if (!empty($comment)) {
    $template = str_replace("<EXIF_COMMENT>",$comment,$template);
    }
    }
    // }}}

    $image_title = "$item[1]";
    $template = str_replace("<IMAGE_TITLE>",$image_title,$template );

    // {{{ ------- my_circular($a_images, $currentPic, $thumb_row);

    function my_circular($thumbnail_dir, &$template, $a_images, $currentPic, $thumb_row, $directory) {
    global $path;
    global $auto_url;

    // get size of $a_images array...
    $number_pics = count($a_images);
    // do a little error checking...
    if ($currentPic > $number_pics) $currentPic = 0;
    if ($currentPic < 0) $currentPic = 0;
    if ($thumb_row < 0) $thumb_row = 1;

    // check if thumbnail row is greater than number of images...
    if ($thumb_row > $number_pics) $thumb_row = $number_pics;

    // split the thumbnail number and make it symmetrical...
    $half = floor($thumb_row/2);

    // show thumbnails
    // left hand thumbs
    if (($currentPic - $half) < 0) { // near the start...
    $underage = ($currentPic-1) - $half;
    for ( $x=($number_pics-abs($underage+1)); $x<$number_pics; $x++) {
    $next=$x;
    $item = explode (";", rtrim($a_images[$x]));
    $out .= "\n[img]$directory/$thumbnail_dir/".$item[0]."[/img]";
    }
    for ( $x=0; $x<$currentPic ; $x++ ) {
    $next=$x;
    $item = explode (";", rtrim($a_images[$x]));
    $out .= "\n[img]$directory/$thumbnail_dir/".$item[0]."[/img]";
    }
    }
    else {
    for ( $x=$currentPic-$half; $x < $currentPic; $x++ ) {
    $next=$x;
    $item = explode (";", rtrim($a_images[$x]));
    $out .= "\n[img]$directory/$thumbnail_dir/".$item[0]."[/img]";
    }
    }

    // show current (center) image thumbnail...
    $item = explode (";", rtrim($a_images[$currentPic]));
    $out .= "\n[img]$directory/$thumbnail_dir/".rtrim($item[0])."[/img]";

    // array for right side...
    if (($currentPic + $half) >= $number_pics) { // near the end
    $overage = (($currentPic + $half) - $number_pics);
    for ( $x=$currentPic+1; $x < $number_pics; $x++) {
    $next=$x;
    $item = explode (";", rtrim($a_images[$x]));
    $out .= "\n[img]$directory/$thumbnail_dir/".$item[0]."[/img]";
    }
    for ( $x=0; $x<=abs($overage); $x++) {
    $next=$x;
    $item = explode (";", rtrim($a_images[$x]));
    $out .= "\n[img]$directory/$thumbnail_dir/".$item[0]."[/img]";
    }
    }
    else {
    for ( $x=$currentPic+1; $x<=$currentPic+$half; $x++ ) { // right hand thumbs
    $next=$x;
    $item = explode (";", rtrim($a_images[$x]));
    $out .= "\n[img]$directory/$thumbnail_dir/".$item[0]."[/img]";
    }
    }
    $template = str_replace("<THUMBNAIL_ROW>",$out,$template);
    }
    // }}}
    // {{{ meta refresh stuff for auto slideshow...
    if ($auto == "1") {
    $auto_url = "&auto=1";
    $meta_refresh = "<meta http-equiv='refresh' content='".$delay;
    $meta_refresh .= ";url=".$path."?directory=".$directory.$auto_url." &currentPic=".$next."'>";
    $template = str_replace("<META_REFRESH>",$meta_refresh,$templa te);
    $auto_slideshow = "$lang_stop_slideshow\n";
    $template = str_replace("<AUTO_SLIDESHOW_LINK>",$auto_slidesho w,$template);
    }
    else {
    $template = str_replace("<META_REFRESH>","",$template);
    $auto_slideshow = "$lang_start_slideshow\n";
    $template = str_replace("<AUTO_SLIDESHOW_LINK>",$auto_slidesho w,$template);
    }
    // }}}

    $images = "<a href='$path?directory=$directory$auto_url&currentP ic=$next'>";
    $images .= "[img]$directory/$item[0][/img]</a>";
    $template = str_replace("<IMAGE>",$images,$template);

    if( file_exists( "$directory/$thumbnail_dir" ) ) {
    my_circular($thumbnail_dir, $template, $pic_info, $currentPic, $thumb_row, $directory);
    }

    $image_filename = "$item[0]";
    $template = str_replace("<IMAGE_FILENAME>",$image_filename,$te mplate);

    echo $template;
    ?>

  8. #8
    Aiutatemi vi prego..

  9. #9
    up up...

  10. #10
    ciao Marketto: è che risulta difficile mettere mano al codice così come l'hai postato: quale sono le righe dove c'è l'errore? I permessi sul file uploadato sono giusti?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.