Visualizzazione risultati 1 fino 1 di 1

Discussione: Problemi con graybox in script php

  1. #1
    akis non è connesso Utente giovane
    Data registrazione
    03-03-2010
    Residenza
    Acireale
    Messaggi
    79

    Predefinito Problemi con graybox in script php

    Salve ragazzi,
    sto ancora lavorando al mio album fotografico... tutto procede bene... ho pure inserito una funzione javascrit per ridimensionare l'immagine in base alla risoluzione del monitor ... però adesso non risco a far funzionare il tutto con greybox.

    riporto integralmente lo script nella speranza che qualcuno mi aiuti a capire dove sbaglio:

    greybox si apre.... però la foto non c'è chi aiuta?

    Codice PHP:
    <script type="text/javascript">
    var GB_ROOT_DIR = "../gallery/greybox/";
    </script>

    <script type="text/javascript" src="greybox/AJS.js"></script>
    <script type="text/javascript" src="greybox/AJS_fx.js"></script>
    <script type="text/javascript" src="greybox/gb_scripts.js"></script>
    <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />


    <?php
    include("config.inc.php");

    // initialization
    $result_array = array();
    $counter = 0;
    $number_of_photos_in_row = 0;
    $result_final = "";



    if (isset(
    $_GET['cid']))
    {
    $cid = (int)($_GET["cid"]);
    }


    if (isset(
    $_GET['pid']))
    {
    $pid = (int)($_GET["pid"]);
    }


    // Category Listing

    if( empty($cid) && empty($pid) )
    {
    $number_of_categories_in_row = 'immagine.style.height'/160;

    $result = mysql_query( "SELECT c.nCategory_id,c.cCategory_name,COUNT(photo_id)
    FROM "
    .$db_prefix."gallery_category as c
    LEFT JOIN "
    .$db_prefix."gallery_photos as p ON p.photo_category = c.nCategory_id
    GROUP BY c.nCategory_id"
    );
    while(
    $row = mysql_fetch_array( $result ) )
    {
    $result_array[] = "<a href='viewgallery.php?cid=".$row[0]."'>".$row[1]."</a> "."(".$row[2].")";
    }
    mysql_free_result( $result );

    $result_final = "<tr>\n";

    foreach(
    $result_array as $category_link)
    {
    if(
    $counter == $number_of_categories_in_row)
    {
    $counter = 1;
    $result_final .= "\n</tr>\n<tr>\n";
    }
    else
    $counter++;

    $result_final .= "\t<td>".$category_link."</td>\n";
    }

    if(
    $counter)
    {
    if(
    $number_of_categories_in_row-$counter)
    $result_final .= "\t<td colspan='".($number_of_categories_in_row-$counter)."'>&nbsp;</td>\n";

    $result_final .= "</tr>";
    }
    }


    // Thumbnail Listing

    else if( $cid && empty( $pid ) )
    {
    $number_of_thumbs_in_row = 'immagine.style.height'/160;

    $result = mysql_query( "SELECT photo_id,photo_caption,photo_filename FROM ".$db_prefix."gallery_photos WHERE photo_category='".addslashes($cid)."'" );
    $nr = mysql_num_rows( $result );

    if( empty(
    $nr ) )
    {
    $result_final = "\t<tr><td align>Non ci sono Foto in questa categoria</td></tr>\n";
    }
    else
    {
    while(
    $row = mysql_fetch_array( $result ) )
    {
    $result_array[] = "<a href='viewgallery.php?cid=$cid&pid=".$row[0]."' rel='gb_imageset[photos]' ><img src='".$images_dir."/tb_".$row[2]."' border='0' alt='".$row[1]."' /></a>";
    }
    mysql_free_result( $result );

    $result_final = "<tr>\n";

    foreach(
    $result_array as $thumbnail_link)
    {
    if(
    $counter == $number_of_thumbs_in_row)
    {
    $counter = 1;
    $result_final .= "\n</tr>\n<tr>\n";
    }
    else
    $counter++;

    $result_final .= "\t<td>".$thumbnail_link."</td>\n";
    }

    if(
    $counter)
    {
    if(
    $number_of_photos_in_row-$counter)
    $result_final .= "\t<td colspan='".($number_of_photos_in_row-$counter)."'>&nbsp;</td>\n";

    $result_final .= "</tr>";
    }
    }
    }

    // Full Size View of Photo
    else if( $pid )
    {
    $result = mysql_query( "SELECT photo_caption,photo_filename FROM ".$db_prefix."gallery_photos WHERE photo_id='".addslashes($pid)."'" );
    list(
    $photo_caption, $photo_filename) = mysql_fetch_array( $result );
    $nr = mysql_num_rows( $result );
    mysql_free_result( $result );

    if( empty(
    $nr ) )
    {
    $result_final = "\t<tr><td>No Photo found</td></tr>\n";
    }
    else
    {
    $result = mysql_query( "SELECT cCategory_name FROM ".$db_prefix."gallery_category WHERE nCategory_id='".addslashes($cid)."'" );
    list(
    $category_name) = mysql_fetch_array($result);
    mysql_free_result($result);

    $result_final .= "<tr>\n\t<td>"
    ."<a href='viewgallery.php'>Categorie</a> &gt;"
    ."<a href='viewgallery.php?cid=$cid'>$category_name</a></td>\n</tr>\n";

    $result_final .= "<tr>\n\t<td align='center'>
    <br />

    <body onLoad='javascript:resize();' onResize='history.go(0)'>
    <img id='miaImg' src='"
    .$images_dir.'/'.$photo_filename."' border='0' alt='".$photo_caption."' />
    <br />
    $photo_caption
    </td>
    </tr>
    </body>"
    ;




    }
    }



    // Final Output
    echo <<<__HTML_END

    <html>
    <head>
    <title>Gallery View</title>

    <script language="javascript">

    function resize()
    {
    var immagine = document.getElementById("miaImg");

    immagine.style.height = document.body.clientHeight * 0.9;

    }


    </script>

    <link rel="stylesheet" href="../blog/themes/cleanlines/global.css">
    </head>
    <body>
    <table width='100%' border='0' align='center' style='width: 100%;'>
    $result_final
    </table>
    </body>
    </html>

    __HTML_END;
    ?>
    Ultima modifica di akis : 14-10-2011 alle ore 15.23.53

Regole di scrittura

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