скрипт фотогалереи

Discussion in 'PHP' started by fire64, 19 Apr 2008.

  1. fire64

    fire64 Elder - Старейшина

    Joined:
    1 Apr 2008
    Messages:
    251
    Likes Received:
    22
    Reputations:
    5
    у меня есть скрипт фотогалереи
    вот как она выглядит фотогалерея


    проблема в том что фотографии начинаются не с начала страницы, а имеют большой отступ
    и фотографии расположены как-то криво, а надо по центру

    подскажите как исправить эти баги


    PHP:
    <?php
    $THUMBNAIL_FOLDER 
    "_thumbnails";
    $HIDDEN_FILES[]    = "Thumbs.db";
    $HIDDEN_FILES[]    = "fljg.txt";
    $HIDDEN_FILES[] = "index.php";
    $HIDDEN_FILES[] = $THUMBNAIL_FOLDER;
    $THUMBNAIL_WIDTH 200;
    $THUMBNAIL_HEIGHT 100;

    // Image Output;
    HandleImageOutput();

    ?>

    <html>
    <head>


     
      
      <title>Фан-сайт Екатерины Кабак - Биография</title>
      <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
      
      
      <link rel="shortcut icon" href="http://kabak.ds8.ru/favicon.ico">

      <meta name="author" content="Alexey">

      <meta name="description" content="Фан-сайт Екатерины Кабак - Биография">

    <link rel="alternate" type="application/rss+xml" title="Сообщения на форуме" href="http://kabak.ds8.ru/forum/rss.php" />  

      <meta name="keywords" content="Екатерина Кабак, Катя Кабак, актриса">

    <meta name="verify-v1" content="gqYybDpdxdgBAgGWThWVw3J/9Z9Kp7ceuk9EtjDKYTA=" />   
      
      
      <style type="text/css">
    <!--

    DIV.image { width: <?php echo $THUMBNAIL_WIDTH?>; height: <?php echo $THUMBNAIL_HEIGHT?>; float: left; margin: 10px; text-align: center; border: 0px; }

    .sub {  font-family: "MS Sans Serif", Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #5e6d82}
    .bod {  font-family: "Arial", sans-serif; font-size: 11px; color: #333333;}
    .sub2 {  font-family: "Times New Roman", Times, serif; font-size: 24px; font-style: italic; color: #5e6d82}
    a            { color: #5e6d82; font-size: 11pt; font-family: "MS Sans Serif", Arial, Helvetica, sans-serif;  text-decoration:none;  font-weight: bold;}
    a:hover      { color: #000000; font-size: 11pt; font-family: "MS Sans Serif", Arial, Helvetica, sans-serif;  font-weight: bold; text-decoration: underline}  
    body { background-color: #dde6f2; font-family: tahoma; font-size: 12px;}

    -->
      </style>
    </head>


    <div align="center">
      
    <table align="center" border="0" cellpadding="0" cellspacing="0" height="100" width="770">

      <tbody>


        <tr>




          <td><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" align="top" height="200" width="770">
              <param name="movie" value="http://kabak.ds8.ru/header.swf">
              <param name="quality" value="high"><param name="LOOP" value="false">
              
          
          
          
          
          <embed src="http://kabak.ds8.ru/header.swf" loop="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" align="top" height="200" width="770"></object></td>





        </tr>  
      
      
    <tbody>
    </table>

    <table border="0" cellpadding="0" cellspacing="0" height="857" width="770">
    <tbody>

    <td background="http://kabak.ds8.ru/images/2bg3.jpg"> 

    <?php

    $Browse 
    $_GET["b"] ;

    if ( 
    $Browse )
    {
        
    $Browse .= "/";
    }

    // Stop them accessing higher level folders
    if ( substr_count$Browse".." ) > || substr_count$Browse$THUMBNAIL_FOLDER ) > 0  )
    {
        echo 
    "You don't have permission to access this folder!";
        exit();
    }

    $DIR "./" $Browse;
    $d dir$DIR );

    while (
    false !== ($entry $d->read())) 
    {
        if (
    $entry[0] == '.') continue;
        if ( 
    in_array$entry$HIDDEN_FILES) ) continue;

        
    // Don't list the folder if it has an index!
        
    if ($entry == 'index.html') exit();
        if (
    $entry == 'index.htm') exit();
        if (
    $entry == 'index.php') exit();
        if (
    $entry == 'index.asp') exit();
        
        if ( 
    IsImage($entry) ) $images[] = array( filemtime$DIR "/" $entry ), $entry );
        else if ( 
    is_dir$DIR "/" $entry ) ) $folders[] = array( filemtime$DIR "/" $entry ), $entry );
        else 
    $files[] = array( filemtime$DIR "/" $entry ), $entry );

    }


    if ( 
    count$folders ) > )
    {
        echo 
    "<div id=\"folders\">";

        
    arsort($folders);
        foreach ( 
    $folders as $fn )
        {
            echo 
    "<a href=\"?b=$Browse$fn[1]\">$fn[1]</a><br>";
        }
        
        echo 
    "</div>";
    }

    if ( 
    count$files ) > )
    {
        echo 
    "<div id=\"files\">";

        
    arsort($files);
        foreach ( 
    $files as $fn )
        {
            echo 
    "<a href=\"$Browse$fn[1]\">$fn[1]</a><br>";
        }
        
        echo 
    "</div>";
    }

    if ( 
    count$images ) > )
    {
        echo 
    "<div id=\"images\"><div style=\"clear: both;\"></div>";

        
    arsort($images);
        foreach ( 
    $images as $fn )
        {
            echo 
    GetImageLink$Browse $fn[1], $fn[1] );
        }
        
        echo 
    "<div style=\"clear: both;\"></div></div>";
    }

    ?>

    <tbody>
    </table>

    <table border="0" cellpadding="0" cellspacing="0" height="35" width="770">









        <tbody>








        <tr>









          <td background="http://kabak.ds8.ru/images/footer2.jpg" height="35" width="770"> 
            
          
          
          
          
          
          
          
          
          <div align="right"> 
              
          
          
          
          
          
          
          
          
          <p class="bod" align="center"><span class="sub"><a href="index.htm">Статьи</a> 
                / <a href="biografiya.htm">Биография</a> / <a href="filmografiya.htm">Фильмография</a> / <a href="forum">Форум</a> 
                &nbsp; &nbsp;&nbsp; </span> &nbsp;&nbsp;&nbsp;&nbsp;&copy;2008 
                Алексей Владимирович &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Privacy 
                Policy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p>









            </div>









          </td>









        </tr>









      
      
      
      
      
      
      
      
      
      </tbody>
    </table>









    </div>


    </body>
    </html>


    <?

     ////// FUNCTIONS /////
     
        function IsImage( $i )
        {
            $i = strtolower( $i );
            
            if ( substr_count( $i, ".jpg" ) > 0  ||
                 substr_count( $i, ".jpeg" ) > 0 ||
                 substr_count( $i, ".gif" ) > 0 ||
                 substr_count( $i, ".png" ) > 0 )
            {
                return true;
            }
            
            return false;
        }
        
        
        function GetImageLink( $imgfilename, $img )
        {
            global $THUMBNAIL_WIDTH, $THUMBNAIL_HEIGHT;
            return "<div class=\"image\"><a href=\"$imgfilename\"><img src=\"?img=$imgfilename\" width=$THUMBNAIL_WIDTH height=$THUMBNAIL_HEIGHT></a><br>$img</div>";
        }
        
        function HandleImageOutput()
        {
            global $THUMBNAIL_FOLDER, $THUMBNAIL_WIDTH, $THUMBNAIL_HEIGHT;
            
            $image = $_GET['img'];
            if (!$image) return;
            
            $imagecache = $THUMBNAIL_FOLDER . "/" . md5( $THUMBNAIL_WIDTH . $THUMBNAIL_HEIGHT . $image ) . ".jpg";
            
            $im = @imagecreatefromjpeg( $imagecache );
            if ( $im )
            {
                header("Content-type: image/jpg");
                imagejpeg($im);                            
                imagedestroy($im);                    
                exit();
            }
            
            $imgsize = getimagesize ( $image );
            
            switch ($imgsize[2]) 
            {
                  case 1: // GIF
                    $im        = imagecreatefromgif( $image );
                    break;
                   case 2: // JPG
                    $im        = imagecreatefromjpeg( $image );
                    break;
                   case 3: // PNG
                    $im        = imagecreatefrompng( $image );
                    break;
                default: // UNKNOWM!
                    echo "Unknown Image!";
                    exit();        
            }
            
            header("Content-type: image/jpg");

            $img_thumb = imagecreatetruecolor( $THUMBNAIL_WIDTH, $THUMBNAIL_HEIGHT );
            
            $dsth = ($THUMBNAIL_WIDTH / ImageSX($im)) * ImageSY($im);
            
            imagecopyresampled( $img_thumb, $im, 0,($THUMBNAIL_HEIGHT-$dsth)/2, 0,0, $THUMBNAIL_WIDTH, $dsth, ImageSX($im), ImageSY($im) );
            
            imagejpeg( $img_thumb );
            
            // This will fail if you haven't created and chmodded your thumbnails folder
            if ( $im && $img_thumb )
            {
                @imagejpeg( $img_thumb, $imagecache, 95 );
            }
            
            imagedestroy( $img_thumb );
            imagedestroy( $im );
            exit();
        }
    ?>
     
  2. Avant

    Avant Elder - Старейшина

    Joined:
    9 Aug 2007
    Messages:
    140
    Likes Received:
    6
    Reputations:
    0
    Попробуй так :)
    PHP:
    <?php
    $THUMBNAIL_FOLDER 
    "_thumbnails";
    $HIDDEN_FILES[]    = "Thumbs.db";
    $HIDDEN_FILES[]    = "fljg.txt";
    $HIDDEN_FILES[] = "index.php";
    $HIDDEN_FILES[] = $THUMBNAIL_FOLDER;
    $THUMBNAIL_WIDTH 200;
    $THUMBNAIL_HEIGHT 100;

    // Image Output;
    HandleImageOutput();

    ?>

    <html>
    <head>


     
      
      <title>Фан-сайт Екатерины Кабак - Биография</title>
      <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
      
      
      <link rel="shortcut icon" href="http://kabak.ds8.ru/favicon.ico">

      <meta name="author" content="Alexey">

      <meta name="description" content="Фан-сайт Екатерины Кабак - Биография">

    <link rel="alternate" type="application/rss+xml" title="Сообщения на форуме" href="http://kabak.ds8.ru/forum/rss.php" />  

      <meta name="keywords" content="Екатерина Кабак, Катя Кабак, актриса">

    <meta name="verify-v1" content="gqYybDpdxdgBAgGWThWVw3J/9Z9Kp7ceuk9EtjDKYTA=" />   
      
      
      <style type="text/css">
    <!--

    DIV.image { width: <?php echo $THUMBNAIL_WIDTH?>; height: <?php echo $THUMBNAIL_HEIGHT?>; float: left; margin: 10px; text-align: center; border: 0px; }

    .sub {  font-family: "MS Sans Serif", Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #5e6d82}
    .bod {  font-family: "Arial", sans-serif; font-size: 11px; color: #333333;}
    .sub2 {  font-family: "Times New Roman", Times, serif; font-size: 24px; font-style: italic; color: #5e6d82}
    a            { color: #5e6d82; font-size: 11pt; font-family: "MS Sans Serif", Arial, Helvetica, sans-serif;  text-decoration:none;  font-weight: bold;}
    a:hover      { color: #000000; font-size: 11pt; font-family: "MS Sans Serif", Arial, Helvetica, sans-serif;  font-weight: bold; text-decoration: underline}  
    body { background-color: #dde6f2; font-family: tahoma; font-size: 12px;}

    -->
      </style>
    </head>


    <div align="center">
      
    <table align="center" border="0" cellpadding="0" cellspacing="0" height="100" width="770">

      <tbody>


        <tr>




          <td><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" align="top" height="200" width="770">
              <param name="movie" value="http://kabak.ds8.ru/header.swf">
              <param name="quality" value="high"><param name="LOOP" value="false">
              
          
          
          
          
          <embed src="http://kabak.ds8.ru/header.swf" loop="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" align="top" height="200" width="770"></object></td>





        </tr>  
      
      
    <tbody>
    </table>

    <table border="0" cellpadding="0" cellspacing="0" height="857" width="770">
    <tbody>

    <td align="center" valign="top" background="http://kabak.ds8.ru/images/2bg3.jpg"> 

    <?php

    $Browse 
    $_GET["b"] ;

    if ( 
    $Browse )
    {
        
    $Browse .= "/";
    }

    // Stop them accessing higher level folders
    if ( substr_count$Browse".." ) > || substr_count$Browse$THUMBNAIL_FOLDER ) > 0  )
    {
        echo 
    "You don't have permission to access this folder!";
        exit();
    }

    $DIR "./" $Browse;
    $d dir$DIR );

    while (
    false !== ($entry $d->read())) 
    {
        if (
    $entry[0] == '.') continue;
        if ( 
    in_array$entry$HIDDEN_FILES) ) continue;

        
    // Don't list the folder if it has an index!
        
    if ($entry == 'index.html') exit();
        if (
    $entry == 'index.htm') exit();
        if (
    $entry == 'index.php') exit();
        if (
    $entry == 'index.asp') exit();
        
        if ( 
    IsImage($entry) ) $images[] = array( filemtime$DIR "/" $entry ), $entry );
        else if ( 
    is_dir$DIR "/" $entry ) ) $folders[] = array( filemtime$DIR "/" $entry ), $entry );
        else 
    $files[] = array( filemtime$DIR "/" $entry ), $entry );

    }


    if ( 
    count$folders ) > )
    {
        echo 
    "<div id=\"folders\">";

        
    arsort($folders);
        foreach ( 
    $folders as $fn )
        {
            echo 
    "<a href=\"?b=$Browse$fn[1]\">$fn[1]</a><br>";
        }
        
        echo 
    "</div>";
    }

    if ( 
    count$files ) > )
    {
        echo 
    "<div id=\"files\">";

        
    arsort($files);
        foreach ( 
    $files as $fn )
        {
            echo 
    "<a href=\"$Browse$fn[1]\">$fn[1]</a><br>";
        }
        
        echo 
    "</div>";
    }

    if ( 
    count$images ) > )
    {
        echo 
    "<div id=\"images\"><div style=\"clear: both;\"></div>";

        
    arsort($images);
        foreach ( 
    $images as $fn )
        {
            echo 
    GetImageLink$Browse $fn[1], $fn[1] );
        }
        
        echo 
    "<div style=\"clear: both;\"></div></div>";
    }

    ?>
    <tbody>
    </table>

    <table border="0" cellpadding="0" cellspacing="0" height="35" width="770">









        <tbody>








        <tr>









          <td background="http://kabak.ds8.ru/images/footer2.jpg" height="35" width="770"> 
            
          
          
          
          
          
          
          
          
          <div align="right"> 
              
          
          
          
          
          
          
          
          
          <p class="bod" align="center"><span class="sub"><a href="index.htm">Статьи</a> 
                / <a href="biografiya.htm">Биография</a> / <a href="filmografiya.htm">Фильмография</a> / <a href="forum">Форум</a> 
                &nbsp; &nbsp;&nbsp; </span> &nbsp;&nbsp;&nbsp;&nbsp;&copy;2008 
                Алексей Владимирович &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Privacy 
                Policy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p>









            </div>









          </td>









        </tr>









      
      
      
      
      
      
      
      
      
      </tbody>
    </table>









    </div>


    </body>
    </html>


    <?

     ////// FUNCTIONS /////
     
        function IsImage( $i )
        {
            $i = strtolower( $i );
            
            if ( substr_count( $i, ".jpg" ) > 0  ||
                 substr_count( $i, ".jpeg" ) > 0 ||
                 substr_count( $i, ".gif" ) > 0 ||
                 substr_count( $i, ".png" ) > 0 )
            {
                return true;
            }
            
            return false;
        }
        
        
        function GetImageLink( $imgfilename, $img )
        {
            global $THUMBNAIL_WIDTH, $THUMBNAIL_HEIGHT;
            return "<div class=\"image\"><a href=\"$imgfilename\"><img src=\"?img=$imgfilename\" width=$THUMBNAIL_WIDTH height=$THUMBNAIL_HEIGHT></a><br>$img</div>";
        }
        
        function HandleImageOutput()
        {
            global $THUMBNAIL_FOLDER, $THUMBNAIL_WIDTH, $THUMBNAIL_HEIGHT;
            
            $image = $_GET['img'];
            if (!$image) return;
            
            $imagecache = $THUMBNAIL_FOLDER . "/" . md5( $THUMBNAIL_WIDTH . $THUMBNAIL_HEIGHT . $image ) . ".jpg";
            
            $im = @imagecreatefromjpeg( $imagecache );
            if ( $im )
            {
                header("Content-type: image/jpg");
                imagejpeg($im);                            
                imagedestroy($im);                    
                exit();
            }
            
            $imgsize = getimagesize ( $image );
            
            switch ($imgsize[2]) 
            {
                  case 1: // GIF
                    $im        = imagecreatefromgif( $image );
                    break;
                   case 2: // JPG
                    $im        = imagecreatefromjpeg( $image );
                    break;
                   case 3: // PNG
                    $im        = imagecreatefrompng( $image );
                    break;
                default: // UNKNOWM!
                    echo "Unknown Image!";
                    exit();        
            }
            
            header("Content-type: image/jpg");

            $img_thumb = imagecreatetruecolor( $THUMBNAIL_WIDTH, $THUMBNAIL_HEIGHT );
            
            $dsth = ($THUMBNAIL_WIDTH / ImageSX($im)) * ImageSY($im);
            
            imagecopyresampled( $img_thumb, $im, 0,($THUMBNAIL_HEIGHT-$dsth)/2, 0,0, $THUMBNAIL_WIDTH, $dsth, ImageSX($im), ImageSY($im) );
            
            imagejpeg( $img_thumb );
            
            // This will fail if you haven't created and chmodded your thumbnails folder
            if ( $im && $img_thumb )
            {
                @imagejpeg( $img_thumb, $imagecache, 95 );
            }
            
            imagedestroy( $img_thumb );
            imagedestroy( $im );
            exit();
        }
    ?> 
     
    2 people like this.
  3. fire64

    fire64 Elder - Старейшина

    Joined:
    1 Apr 2008
    Messages:
    251
    Likes Received:
    22
    Reputations:
    5
    спасибо, остался последний баг
    изображения не по центру, а по левому краю
    а надо, что бы были по центру
     
  4. Avant

    Avant Elder - Старейшина

    Joined:
    9 Aug 2007
    Messages:
    140
    Likes Received:
    6
    Reputations:
    0
    PHP:
    <?php
    $THUMBNAIL_FOLDER 
    "_thumbnails";
    $HIDDEN_FILES[]    = "Thumbs.db";
    $HIDDEN_FILES[]    = "fljg.txt";
    $HIDDEN_FILES[] = "index.php";
    $HIDDEN_FILES[] = $THUMBNAIL_FOLDER;
    $THUMBNAIL_WIDTH 200;
    $THUMBNAIL_HEIGHT 100;

    // Image Output;
    HandleImageOutput();

    ?>

    <html>
    <head>


     
      
      <title>Фан-сайт Екатерины Кабак - Биография</title>
      <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
      
      
      <link rel="shortcut icon" href="http://kabak.ds8.ru/favicon.ico">

      <meta name="author" content="Alexey">

      <meta name="description" content="Фан-сайт Екатерины Кабак - Биография">

    <link rel="alternate" type="application/rss+xml" title="Сообщения на форуме" href="http://kabak.ds8.ru/forum/rss.php" />  

      <meta name="keywords" content="Екатерина Кабак, Катя Кабак, актриса">

    <meta name="verify-v1" content="gqYybDpdxdgBAgGWThWVw3J/9Z9Kp7ceuk9EtjDKYTA=" />   
      
      
      <style type="text/css">
    <!--

    DIV.image { width: <?php echo $THUMBNAIL_WIDTH?>; height: <?php echo $THUMBNAIL_HEIGHT?>; float: left; margin: 10px; text-align: center; border: 0px; }

    .sub {  font-family: "MS Sans Serif", Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #5e6d82}
    .bod {  font-family: "Arial", sans-serif; font-size: 11px; color: #333333;}
    .sub2 {  font-family: "Times New Roman", Times, serif; font-size: 24px; font-style: italic; color: #5e6d82}
    a            { color: #5e6d82; font-size: 11pt; font-family: "MS Sans Serif", Arial, Helvetica, sans-serif;  text-decoration:none;  font-weight: bold;}
    a:hover      { color: #000000; font-size: 11pt; font-family: "MS Sans Serif", Arial, Helvetica, sans-serif;  font-weight: bold; text-decoration: underline}  
    body { background-color: #dde6f2; font-family: tahoma; font-size: 12px;}

    -->
      </style>
    </head>


    <div align="center">
      
    <table align="center" border="0" cellpadding="0" cellspacing="0" height="100" width="770">

      <tbody>


        <tr>




          <td><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" align="top" height="200" width="770">
              <param name="movie" value="http://kabak.ds8.ru/header.swf">
              <param name="quality" value="high"><param name="LOOP" value="false">
              
          
          
          
          
          <embed src="http://kabak.ds8.ru/header.swf" loop="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" align="top" height="200" width="770"></object></td>





        </tr>  
      
      
    <tbody>
    </table>

    <table border="0" cellpadding="0" cellspacing="0" height="857" width="770" align="center">
    <tbody align="center">

    <td align="center" valign="top" background="http://kabak.ds8.ru/images/2bg3.jpg"> 

    <?php

    $Browse 
    $_GET["b"] ;

    if ( 
    $Browse )
    {
        
    $Browse .= "/";
    }

    // Stop them accessing higher level folders
    if ( substr_count$Browse".." ) > || substr_count$Browse$THUMBNAIL_FOLDER ) > 0  )
    {
        echo 
    "You don't have permission to access this folder!";
        exit();
    }

    $DIR "./" $Browse;
    $d dir$DIR );

    while (
    false !== ($entry $d->read())) 
    {
        if (
    $entry[0] == '.') continue;
        if ( 
    in_array$entry$HIDDEN_FILES) ) continue;

        
    // Don't list the folder if it has an index!
        
    if ($entry == 'index.html') exit();
        if (
    $entry == 'index.htm') exit();
        if (
    $entry == 'index.php') exit();
        if (
    $entry == 'index.asp') exit();
        
        if ( 
    IsImage($entry) ) $images[] = array( filemtime$DIR "/" $entry ), $entry );
        else if ( 
    is_dir$DIR "/" $entry ) ) $folders[] = array( filemtime$DIR "/" $entry ), $entry );
        else 
    $files[] = array( filemtime$DIR "/" $entry ), $entry );

    }


    if ( 
    count$folders ) > )
    {
        echo 
    "<div id=\"folders\">";

        
    arsort($folders);
        foreach ( 
    $folders as $fn )
        {
            echo 
    "<a href=\"?b=$Browse$fn[1]\">$fn[1]</a><br>";
        }
        
        echo 
    "</div>";
    }

    if ( 
    count$files ) > )
    {
        echo 
    "<div id=\"files\">";

        
    arsort($files);
        foreach ( 
    $files as $fn )
        {
            echo 
    "<a href=\"$Browse$fn[1]\">$fn[1]</a><br>";
        }
        
        echo 
    "</div>";
    }

    if ( 
    count$images ) > )
    {
        echo 
    "<div id=\"images\"><div style=\"clear: both;\"></div>";

        
    arsort($images);
        foreach ( 
    $images as $fn )
        {
            echo 
    GetImageLink$Browse $fn[1], $fn[1] );
        }
        
        echo 
    "<div style=\"clear: both;\"></div></div>";
    }

    ?>
    <tbody>
    </table>

    <table border="0" cellpadding="0" cellspacing="0" height="35" width="770">









        <tbody>








        <tr>









          <td background="http://kabak.ds8.ru/images/footer2.jpg" height="35" width="770"> 
            
          
          
          
          
          
          
          
          
          <div align="right"> 
              
          
          
          
          
          
          
          
          
          <p class="bod" align="center"><span class="sub"><a href="index.htm">Статьи</a> 
                / <a href="biografiya.htm">Биография</a> / <a href="filmografiya.htm">Фильмография</a> / <a href="forum">Форум</a> 
                &nbsp; &nbsp;&nbsp; </span> &nbsp;&nbsp;&nbsp;&nbsp;&copy;2008 
                Алексей Владимирович &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Privacy 
                Policy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p>









            </div>









          </td>









        </tr>









      
      
      
      
      
      
      
      
      
      </tbody>
    </table>









    </div>


    </body>
    </html>


    <?

     ////// FUNCTIONS /////
     
        function IsImage( $i )
        {
            $i = strtolower( $i );
            
            if ( substr_count( $i, ".jpg" ) > 0  ||
                 substr_count( $i, ".jpeg" ) > 0 ||
                 substr_count( $i, ".gif" ) > 0 ||
                 substr_count( $i, ".png" ) > 0 )
            {
                return true;
            }
            
            return false;
        }
        
        
        function GetImageLink( $imgfilename, $img )
        {
            global $THUMBNAIL_WIDTH, $THUMBNAIL_HEIGHT;
            return "<div class=\"image\"><a href=\"$imgfilename\"><img src=\"?img=$imgfilename\" width=$THUMBNAIL_WIDTH height=$THUMBNAIL_HEIGHT></a><br>$img</div>";
        }
        
        function HandleImageOutput()
        {
            global $THUMBNAIL_FOLDER, $THUMBNAIL_WIDTH, $THUMBNAIL_HEIGHT;
            
            $image = $_GET['img'];
            if (!$image) return;
            
            $imagecache = $THUMBNAIL_FOLDER . "/" . md5( $THUMBNAIL_WIDTH . $THUMBNAIL_HEIGHT . $image ) . ".jpg";
            
            $im = @imagecreatefromjpeg( $imagecache );
            if ( $im )
            {
                header("Content-type: image/jpg");
                imagejpeg($im);                            
                imagedestroy($im);                    
                exit();
            }
            
            $imgsize = getimagesize ( $image );
            
            switch ($imgsize[2]) 
            {
                  case 1: // GIF
                    $im        = imagecreatefromgif( $image );
                    break;
                   case 2: // JPG
                    $im        = imagecreatefromjpeg( $image );
                    break;
                   case 3: // PNG
                    $im        = imagecreatefrompng( $image );
                    break;
                default: // UNKNOWM!
                    echo "Unknown Image!";
                    exit();        
            }
            
            header("Content-type: image/jpg");

            $img_thumb = imagecreatetruecolor( $THUMBNAIL_WIDTH, $THUMBNAIL_HEIGHT );
            
            $dsth = ($THUMBNAIL_WIDTH / ImageSX($im)) * ImageSY($im);
            
            imagecopyresampled( $img_thumb, $im, 0,($THUMBNAIL_HEIGHT-$dsth)/2, 0,0, $THUMBNAIL_WIDTH, $dsth, ImageSX($im), ImageSY($im) );
            
            imagejpeg( $img_thumb );
            
            // This will fail if you haven't created and chmodded your thumbnails folder
            if ( $im && $img_thumb )
            {
                @imagejpeg( $img_thumb, $imagecache, 95 );
            }
            
            imagedestroy( $img_thumb );
            imagedestroy( $im );
            exit();
        }
    ?> 
    ну так попробуй:)
     
  5. fire64

    fire64 Elder - Старейшина

    Joined:
    1 Apr 2008
    Messages:
    251
    Likes Received:
    22
    Reputations:
    5
    не помогло
     
  6. lll6

    lll6 Elder - Старейшина

    Joined:
    29 Feb 2008
    Messages:
    83
    Likes Received:
    15
    Reputations:
    5
    PHP:
    <?php 
    $THUMBNAIL_FOLDER 
    "_thumbnails"
    $HIDDEN_FILES[]    = "Thumbs.db"
    $HIDDEN_FILES[]    = "fljg.txt"
    $HIDDEN_FILES[] = "index.php"
    $HIDDEN_FILES[] = $THUMBNAIL_FOLDER
    $THUMBNAIL_WIDTH 200
    $THUMBNAIL_HEIGHT 100

    // Image Output; 
    HandleImageOutput(); 

    ?> 

    <html> 
    <head> 


      
       
      <title>Фан-сайт Екатерины Кабак - Биография</title> 
      <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> 
       
       
      <link rel="shortcut icon" href="http://kabak.ds8.ru/favicon.ico"> 

      <meta name="author" content="Alexey"> 

      <meta name="description" content="Фан-сайт Екатерины Кабак - Биография"> 

    <link rel="alternate" type="application/rss+xml" title="Сообщения на форуме" href="http://kabak.ds8.ru/forum/rss.php" />   

      <meta name="keywords" content="Екатерина Кабак, Катя Кабак, актриса"> 

    <meta name="verify-v1" content="gqYybDpdxdgBAgGWThWVw3J/9Z9Kp7ceuk9EtjDKYTA=" />    
       
       
      <style type="text/css"> 
    <!-- 

    DIV.image { width: <?php echo $THUMBNAIL_WIDTH?>; height: <?php echo $THUMBNAIL_HEIGHT?>; float: left; margin: 70px; text-align: center; border: 0px; } 

    .sub {  font-family: "MS Sans Serif", Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #5e6d82} 
    .bod {  font-family: "Arial", sans-serif; font-size: 11px; color: #333333;} 
    .sub2 {  font-family: "Times New Roman", Times, serif; font-size: 24px; font-style: italic; color: #5e6d82} 
    a            { color: #5e6d82; font-size: 11pt; font-family: "MS Sans Serif", Arial, Helvetica, sans-serif;  text-decoration:none;  font-weight: bold;} 
    a:hover      { color: #000000; font-size: 11pt; font-family: "MS Sans Serif", Arial, Helvetica, sans-serif;  font-weight: bold; text-decoration: underline}   
    body { background-color: #dde6f2; font-family: tahoma; font-size: 12px;} 

    --> 
      </style> 
    </head> 


    <div align="center"> 
       
    <table align="center" border="0" cellpadding="0" cellspacing="0" height="100" width="770"> 

      <tbody> 


        <tr> 




          <td><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" align="top" height="200" width="770"> 
              <param name="movie" value="http://kabak.ds8.ru/header.swf"> 
              <param name="quality" value="high"><param name="LOOP" value="false"> 
               
           
           
           
           
          <embed src="http://kabak.ds8.ru/header.swf" loop="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" align="top" height="200" width="770"></object></td> 





        </tr>   
       
       
    <tbody> 
    </table> 

    <table border="0" cellpadding="0" cellspacing="0" height="857" width="770"> 
    <tbody> 

    <td background="http://kabak.ds8.ru/images/2bg3.jpg">  

    <?php 

    $Browse 
    $_GET["b"] ; 

    if ( 
    $Browse 

        
    $Browse .= "/"


    // Stop them accessing higher level folders 
    if ( substr_count$Browse".." ) > || substr_count$Browse$THUMBNAIL_FOLDER ) > 0  

        echo 
    "You don't have permission to access this folder!"
        exit(); 


    $DIR "./" $Browse
    $d dir$DIR ); 

    while (
    false !== ($entry $d->read()))  

        if (
    $entry[0] == '.') continue; 
        if ( 
    in_array$entry$HIDDEN_FILES) ) continue; 

        
    // Don't list the folder if it has an index! 
        
    if ($entry == 'index.html') exit(); 
        if (
    $entry == 'index.htm') exit(); 
        if (
    $entry == 'index.php') exit(); 
        if (
    $entry == 'index.asp') exit(); 
         
        if ( 
    IsImage($entry) ) $images[] = array( filemtime$DIR "/" $entry ), $entry ); 
        else if ( 
    is_dir$DIR "/" $entry ) ) $folders[] = array( filemtime$DIR "/" $entry ), $entry ); 
        else 
    $files[] = array( filemtime$DIR "/" $entry ), $entry ); 




    if ( 
    count$folders ) > 

        echo 
    "<div id=\"folders\">"

        
    arsort($folders); 
        foreach ( 
    $folders as $fn 
        { 
            echo 
    "<a href=\"?b=$Browse$fn[1]\">$fn[1]</a><br>"
        } 
         
        echo 
    "</div>"


    if ( 
    count$files ) > 

        echo 
    "<div id=\"files\">"

        
    arsort($files); 
        foreach ( 
    $files as $fn 
        { 
            echo 
    "<a href=\"$Browse$fn[1]\">$fn[1]</a><br>"
        } 
         
        echo 
    "</div>"


    if ( 
    count$images ) > 

        echo 
    "<div id=\"images\"><div style=\"clear: both;\"></div>"

        
    arsort($images); 
        foreach ( 
    $images as $fn 
        { 
            echo 
    GetImageLink$Browse $fn[1], $fn[1] ); 
        } 
         
        echo 
    "<div style=\"clear: both;\"></div></div>"


    ?> 

    <tbody> 
    </table> 

    <table border="0" cellpadding="0" cellspacing="0" height="35" width="770"> 









        <tbody> 








        <tr> 









          <td background="http://kabak.ds8.ru/images/footer2.jpg" height="35" width="770">  
             
           
           
           
           
           
           
           
           
          <div align="right">  
               
           
           
           
           
           
           
           
           
          <p class="bod" align="center"><span class="sub"><a href="index.htm">Статьи</a>  
                / <a href="biografiya.htm">Биография</a> / <a href="filmografiya.htm">Фильмография</a> / <a href="forum">Форум</a>  
                &nbsp; &nbsp;&nbsp; </span> &nbsp;&nbsp;&nbsp;&nbsp;&copy;2008  
                Алексей Владимирович &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Privacy  
                Policy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p> 









            </div> 









          </td> 









        </tr> 









       
       
       
       
       
       
       
       
       
      </tbody> 
    </table> 









    </div> 


    </body> 
    </html> 


    <? 

     ////// FUNCTIONS ///// 
      
        function IsImage( $i ) 
        { 
            $i = strtolower( $i ); 
             
            if ( substr_count( $i, ".jpg" ) > 0  || 
                 substr_count( $i, ".jpeg" ) > 0 || 
                 substr_count( $i, ".gif" ) > 0 || 
                 substr_count( $i, ".png" ) > 0 ) 
            { 
                return true; 
            } 
             
            return false; 
        } 
         
         
        function GetImageLink( $imgfilename, $img ) 
        { 
            global $THUMBNAIL_WIDTH, $THUMBNAIL_HEIGHT; 
            return "<div class=\"image\"><a href=\"$imgfilename\"><img src=\"?img=$imgfilename\" width=$THUMBNAIL_WIDTH height=$THUMBNAIL_HEIGHT></a><br>$img</div>"; 
        } 
         
        function HandleImageOutput() 
        { 
            global $THUMBNAIL_FOLDER, $THUMBNAIL_WIDTH, $THUMBNAIL_HEIGHT; 
             
            $image = $_GET['img']; 
            if (!$image) return; 
             
            $imagecache = $THUMBNAIL_FOLDER . "/" . md5( $THUMBNAIL_WIDTH . $THUMBNAIL_HEIGHT . $image ) . ".jpg"; 
             
            $im = @imagecreatefromjpeg( $imagecache ); 
            if ( $im ) 
            { 
                header("Content-type: image/jpg"); 
                imagejpeg($im);                             
                imagedestroy($im);                     
                exit(); 
            } 
             
            $imgsize = getimagesize ( $image ); 
             
            switch ($imgsize[2])  
            { 
                  case 1: // GIF 
                    $im        = imagecreatefromgif( $image ); 
                    break; 
                   case 2: // JPG 
                    $im        = imagecreatefromjpeg( $image ); 
                    break; 
                   case 3: // PNG 
                    $im        = imagecreatefrompng( $image ); 
                    break; 
                default: // UNKNOWM! 
                    echo "Unknown Image!"; 
                    exit();         
            } 
             
            header("Content-type: image/jpg"); 

            $img_thumb = imagecreatetruecolor( $THUMBNAIL_WIDTH, $THUMBNAIL_HEIGHT ); 
             
            $dsth = ($THUMBNAIL_WIDTH / ImageSX($im)) * ImageSY($im); 
             
            imagecopyresampled( $img_thumb, $im, 0,($THUMBNAIL_HEIGHT-$dsth)/2, 0,0, $THUMBNAIL_WIDTH, $dsth, ImageSX($im), ImageSY($im) ); 
             
            imagejpeg( $img_thumb ); 
             
            // This will fail if you haven't created and chmodded your thumbnails folder 
            if ( $im && $img_thumb ) 
            { 
                @imagejpeg( $img_thumb, $imagecache, 95 ); 
            } 
             
            imagedestroy( $img_thumb ); 
            imagedestroy( $im ); 
            exit(); 
        } 
    ?>
    Попробуй, затестить не могу
     
    1 person likes this.
  7. fire64

    fire64 Elder - Старейшина

    Joined:
    1 Apr 2008
    Messages:
    251
    Likes Received:
    22
    Reputations:
    5
    lll6, специально размер подгонял ?
     
  8. lll6

    lll6 Elder - Старейшина

    Joined:
    29 Feb 2008
    Messages:
    83
    Likes Received:
    15
    Reputations:
    5
    На глаз) Получилось?
     
  9. fire64

    fire64 Elder - Старейшина

    Joined:
    1 Apr 2008
    Messages:
    251
    Likes Received:
    22
    Reputations:
    5
    почти, в принципе нормально получилось

    http://kabak.ds8.ru/foto/
     
  10. lll6

    lll6 Elder - Старейшина

    Joined:
    29 Feb 2008
    Messages:
    83
    Likes Received:
    15
    Reputations:
    5
    Угу, даже оригинально)
     
  11. fire64

    fire64 Elder - Старейшина

    Joined:
    1 Apr 2008
    Messages:
    251
    Likes Received:
    22
    Reputations:
    5
    да дизайн оригинальный получился :)