Visualizzazione risultati 1 fino 4 di 4

Discussione: Aiuto per modifica di uno script per la pubblicazione di img

  1. #1
    L'avatar di RpgWorld
    RpgWorld non è connesso Utente giovane
    Data registrazione
    28-04-2003
    Messaggi
    74

    Predefinito

    Ciao a tutti ho un grave problema dovuto alla mia novizia passione per il php (non sono ancora esperto) per varie esigenze stavo cercando di modificare e migliorare una funziona dello script PPA uno script per pubblicare gallery di img...Il mio scopo era quello di inserire oltre alla img rimpicciolita anche a finaco la descrizione della stessa e il nome della foto naturalmente precedentemente salvate in una tabella...

    questo è il codice come io l'ho modificato

    ################################################## ################################################## ############################# Display thumbnails
    function thumbnails($album, $start_side_pic) {
    global $config, $logged_in;
    global $lng_text;
    global $start_side_pic;
    $thbn = $thbn . "";

    if(!isset($album)) { // Wann kommt das ?? NIE ??
    $thbn = $thbn . "$lng_text[116]<br><br>\n"; // Album aussuchen
    $thbn = $thbn . "<b>- <a href='$config[ppa_web_path]index.php'>$lng_text[117]</a></b>"; // Albumlisten
    return $thbn;
    }

    // DB verbinden Funktion aufrufen
    $conn = db_connect();
    // Alles aus DB holen was zum Album X gehört
    $result = mysql_query("SELECT * from $config[TABLE_PICTURES] WHERE aid='$album'");

    $query_picture = "SELECT * FROM ppa_pictures ORDER BY pid";

    $result_picture = mysql_query($query_picture, $conn);
    $row_picture = mysql_fetch_array($result_picture);


    // Album Beschreibung auslesen
    $result_album = mysql_query("SELECT description from $config[TABLE_ALBUMS] WHERE aid='$album'");
    $query_album_data = mysql_fetch_row($result_album);
    $album_desc = $query_album_data[0];

    // Zähle wieviele Zeilen (Bilder) dann entgülltig da sind
    $count = mysql_num_rows($result);

    $Pics_per_side = $config['thumbcols'] * $config['thumbrows'];

    $thbn = $thbn . "<tr><td colspan='$config[thumbcols]'><div style='thumbnails' align='right'>$lng_text[118] [ <b>$album_desc</b> ]<hr></div></td></tr>\n"; //Topic
    $thbn = $thbn . "<tr>\n";

    if($logged_in == $config['admin_password']) $thbn = $thbn . js_confirms();

    $pic_in_the_cols = 1; // Vertikaler Counter auf 1 Setzen (Bild oben Links)
    if ($start_side_pic==false) $start_side_pic = 0; // Horiontaler Counter auf 1 Setzen (Seite 1)

    // Bilder anzeigen die im $result stecken
    if($count > 0) {

    $fpath_to_pic = array();
    $apath_to_pic = array();
    $save_pid = array();
    $for_counter = 0;

    while($row = mysql_fetch_array($result)) // solange Schleifen bis alle Bilder ausgegeben sind
    {
    $fpath_to_pic[$for_counter] = $config['ppa_root_path'] . $config['ppa_album_dir'] . $row["filepath"] . "thumb_" . $row["filename"];
    $apath_to_pic[$for_counter] = $config['ppa_web_path'] . $config['ppa_album_dir'] . $row["filepath"] . "thumb_" . $row["filename"];
    $save_pid[$for_counter] = $row["pid"];
    $for_counter++;
    }


    $side_end = $Pics_per_side + $start_side_pic;
    if ($side_end > sizeof($fpath_to_pic)) $side_end = sizeof($fpath_to_pic);

    for ($for_counter2 = $start_side_pic; $for_counter2 < $side_end; $for_counter2++) {

    $ant_cmts = count(get_comments($save_pid[$for_counter2])); // Kommentare zum Bild auslesen und durchzählen
    $imagesize = getImageSize($fpath_to_pic[$for_counter2]); // Bild Größe des Thumbnick feststellen und als (width="??" height="??) speichern

    $thbn = $thbn . "<td valign='top' class='thumbnails' align='center' width='" . ceil($config['thumbcols']/100) . "%'>"; // Horizontale Tabelle beginnen
    $thbn = $thbn . "<a href='$config[ppa_web_path]screens/displayimage.php?pid=" . $save_pid[$for_counter2] . "' class='thumbnails'>";// Link zum grossen Bild
    $thbn = $thbn . "<img src='$apath_to_pic[$for_counter2]' $imagesize[3] border='1' alt='$row[pic_desc]'> $nomefile"; // Thumbnail anzeigen
    $thbn = $thbn . "</a>";
    $thbn = $thbn . "Nome File : $row_picture[filename] <br>";
    $thbn = $thbn . "Dimensioni : $row_picture[filesize] <br>";
    $thbn = $thbn . "Descrizione : $row_picture[pic_desc] <br>";


    if($ant_cmts > 0)
    {
    $thbn = $thbn . "<br><div class='small'>$ant_cmts $lng_text[119]</div>"; // Wenn Kommentare da unter dem Thumbnail anzeigen wie viele es sind
    }

    if($logged_in == $config['admin_password']) // Wenn Admin dann Löschen text drunter anzeigen
    {
    $thbn = $thbn . show_picturemenu_small($save_pid[$for_counter2]);
    $thbn = $thbn . "</td>\n";
    }

    if($pic_in_the_cols==$config['thumbcols']) // Wenn genug Bilder in der Breite vorhanden, nächste Zeile anwählen
    {
    $thbn = $thbn . "</tr>\n";
    $thbn = $thbn . "<tr>\n";
    $pic_in_the_cols = 1;
    } else {
    $pic_in_the_cols++;
    }

    }

    } else { // Wenn keine Bilder da zeige den Text zum Album erstellen, ec. ...
    if (strlen($album_desc) < 1 ) {
    $thbn = $thbn . "<td valign='top' class='thumbnails'>";
    $thbn = $thbn . "<center><br><br><b><fo nt color=red>$lng_text[243]</font></b><br><br></center>";
    $thbn = $thbn . "</td>\n";
    } else {
    $thbn = $thbn . "<td valign='top' class='thumbnails'>";
    $thbn = $thbn . "<b>$lng_text[120] $album $lng_text[121]<br>\n";
    $thbn = $thbn . "<li><a href='$config[ppa_web_path]screens/admin.php?album=$album'>$lng_text[122]</a><br>\n";
    $thbn = $thbn . "<li><a href='$config[ppa_web_path]index.php'>$lng_text[123]</a><br>\n";
    $thbn = $thbn . "</td>\n";
    }
    }
    $thbn = $thbn . thumbnails_menu($album, $start_side_pic);
    return $thbn;
    }
    Ora però facendo in questo modo lo script ripete per ogni thumb la descrizione del primo pid o meglio della prima foto inserita mentre se provo a fare un ciclo while (che provabilmente sbaglio a inserire) mi inserisce solo l'ultima descrizione della img inserita e naturalmente nella prima pic lasciando vuote le altre...

    Premetto che mi fareste un grandissimo piacere se postaste direttamente il codice corretto...Viste le mie lacune su questo linguaggio.

    Grazie in anticipo

  2. #2
    L'avatar di RpgWorld
    RpgWorld non è connesso Utente giovane
    Data registrazione
    28-04-2003
    Messaggi
    74

    Predefinito

    nessuno riesce ad'aiutarmi ?...

    Per favore

  3. #3
    Guest

    Predefinito

    Lo stesso risultato l'ho ottenuto senza utilizzare un database, ma solo le immagini e altrettanti corrispondenti files di testo con lo stesso nome delle immagini (cambia l'estensione ovviamente). Magari posto un po' di codice :o

  4. #4
    L'avatar di RpgWorld
    RpgWorld non è connesso Utente giovane
    Data registrazione
    28-04-2003
    Messaggi
    74

    Predefinito

    Grazie per il supporto ma sono riuscito a modificarlo correttamente lo script...Per tutti quelli che
    usano come me il PPA gallery e volesse le modifiche che io ho apportato ecco il codice corretto...
    In attesa che il creatore dello script uppi la nuova versione con le mie modifiche ;) (gli ho già fornito la traduzione italiana..)


    [code:1:3393787f54]
    ################################################## ################################################## ############################# Display thumbnails modify by Eternity6!! Now: name of img - desc of img - hits of img - in 2° TD Run & FixBug On img ALT Tag
    function thumbnails($album, $start_side_pic) {
    global $config, $logged_in;
    global $lng_text;
    global $start_side_pic;
    $thbn = $thbn . "";

    if(!isset($album)) { // Wann kommt das ?? NIE ??
    $thbn = $thbn . "$lng_text[116]<br><br>\n "; // Album aussuchen
    $thbn = $thbn . "<b>- <a href='$config[ppa_web_path]index.php'>$ lng_text[117]</a></b>"; // Albumlisten
    return $thbn;
    }

    // DB verbinden Funktion aufrufen
    $conn = db_connect();
    // Alles aus DB holen was zum Album X gehört
    $result = mysql_query("SELECT * from $config[TABLE_PICTURES] WHERE aid='$album'");

    // Album Beschreibung auslesen
    $result_album = mysql_query("SELECT description from $config[TABLE_ALBUMS] WHERE aid='$album'");
    $query_album_data = mysql_fetch_row($result_album);
    $album_desc = $query_album_data[0];

    // Zähle wieviele Zeilen (Bilder) dann entgülltig da sind
    $count = mysql_num_rows($result);

    $Pics_per_side = $config['thumbcols'] * $config['thumbrows'];

    $thbn = $thbn . "<tr><td colspan='$config[thumbcols]'><div style='thumbnails' align='right'>$lng_text[118] [ <b>$album_desc</b> ]<hr></div></td></tr>\n"; //Topic
    $thbn = $thbn . "<tr>\n";

    if($logged_in == $config['admin_password']) $thbn = $thbn . js_confirms();

    $pic_in_the_cols = 1; // Vertikaler Counter auf 1 Setzen (Bild oben Links)
    if ($start_side_pic==false) $start_side_pic = 0; // Horiontaler Counter auf 1 Setzen (Seite 1)

    // Bilder anzeigen die im $result stecken
    if($count > 0) {

    $fpath_to_pic = array();
    $apath_to_pic = array();
    $save_pid = array();
    $nome_foto = array();
    $descrizione_foto = array();
    $valutazione_foto = array();
    $punti_foto = array();
    $for_counter = 0;

    while($row = mysql_fetch_array($result)) // solange Schleifen bis alle Bilder ausgegeben sind
    {

    $fpath_to_pic[$for_counter] = $config['ppa_root_path'] . $config['ppa_album_dir'] . $row["filepath"] . "thumb_" . $row["filename"];
    $apath_to_pic[$for_counter] = $config['ppa_web_path'] . $config['ppa_album_dir'] . $row["filepath"] . "thumb_" . $row["filename"];
    $save_pid[$for_counter] = $row["pid"];
    $nome_foto[$for_counter] = $row["filename"];
    $descrizione_foto[$for_counter] = $row["pic_desc"];
    $valutazione_foto[$for_counter] = $row["vote_rates"];
    $punti_foto[$for_counter] = $row["hits"];
    $for_counter++;
    }

    $side_end = $Pics_per_side + $start_side_pic;
    if ($side_end > sizeof($fpath_to_pic)) $side_end = sizeof($fpath_to_pic);

    for ($for_counter2 = $start_side_pic; $for_counter2 < $side_end; $for_counter2++) {

    $ant_cmts = count(get_comments($save_pid[$for_coun ter2])); // Kommentare zum Bild auslesen und durchzählen
    $imagesize = getImageSize($fpath_to_pic[$for_counter2&# 93;); // Bild Größe des Thumbnick feststellen und als (width="??" height="??) speichern

    $thbn = $thbn . "<td valign='top' class='thumbnails' align='center' width='" . ceil($config['thumbcols']/100) . "%'>"; // Horizontale Tabelle beginnen
    $thbn = $thbn . "<a href='$config[ppa_web_path]screens/displayimage.php?pid=" . $save_pid[$for_counter2] . "' class='thumbnails'>";// Link zum grossen Bild
    $thbn = $thbn . "<img src='$apath_to_pic[$for_counter2]' $imagesize[3] border='1' alt='$descrizione_foto[$for_counter2]'> "; // Thumbnail anzeigen
    $thbn = $thbn . "</a>";
    $thbn = $thbn . "</td>";
    $thbn = $thbn . "<td>";
    $thbn = $thbn . "Nome File: $nome_foto[$for_counter2]<br>";
    $thbn = $thbn . "Descrizione: $descrizione_foto[$for_counter2]<br> ";
    $thbn = $thbn . "Valutazione: $valutazione_foto[$for_counter2]<br> ";
    $thbn = $thbn . "Punteggio: $punti_foto[$for_counter2]<br>" ;
    $thbn = $thbn . "</td>";
    $thbn = $thbn . "<tr>";
    if($ant_cmts > 0)
    {
    $thbn = $thbn . "<br><div class='small'>$ant_cmts $lng_text[119]</div>"; // Wenn Kommentare da unter dem Thumbnail anzeigen wie viele es sind
    }

    if($logged_in == $config['admin_password']) // Wenn Admin dann Löschen text drunter anzeigen
    {
    $thbn = $thbn . show_picturemenu_small($save_pid[$for_coun ter2]);

    $thbn = $thbn . "</td>\n";
    }

    if($pic_in_the_cols==$config['thumbcols'&# 93;) // Wenn genug Bilder in der Breite vorhanden, nächste Zeile anwählen
    {
    $thbn = $thbn . "</tr>\n";
    $thbn = $thbn . "<tr>\n";
    $pic_in_the_cols = 1;
    } else {
    $pic_in_the_cols++;
    }

    }

    } else { // Wenn keine Bilder da zeige den Text zum Album erstellen, ec. ...
    if (strlen($album_desc) < 1 ) {
    $thbn = $thbn . "<td valign='top' class='thumbnails'>";
    $thbn = $thbn . "<center><br><br><b>& lt;font color=red>$lng_text[243]</font></b><br><br></center>";
    $thbn = $thbn . "</td>\n";
    } else {
    $thbn = $thbn . "<td valign='top' class='thumbnails'>";
    $thbn = $thbn . "<b>$lng_text[120] $album $lng_text[121]<br>\n";
    $thbn = $thbn . "<li><a href='$config[ppa_web_path]screens/admin.php?album=$album'>$lng_text[122]& lt;/a><br>\n";
    $thbn = $thbn . "<li><a href='$config[ppa_web_path]index.php'>$ lng_text[123]</a><br>\n";
    $thbn = $thbn . "</td>\n";
    }
    }
    $thbn = $thbn . thumbnails_menu($album, $start_side_pic);
    return $thbn;
    }


    [/code:1:3393787f54]

    Ciao a tutti

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •