ANTICHAT Forum
HOME FORUMS MEMBERS RECENT POSTS LOG IN  
Баннер 1   Баннер 2
НОВЫЕ ТОРГОВАЯ НОВОСТИ
loading...
Скрыть
Вернуться   ANTICHAT > ПРОГРАММИРОВАНИЕ > PHP
   
 
 
Опции темы Поиск в этой теме Опции просмотра

скрипт фотогалереи
  #1  
Старый 19.04.2008, 17:04
fire64
Участник форума
Регистрация: 01.04.2008
Сообщений: 200
С нами: 9531722

Репутация: 39
По умолчанию скрипт фотогалереи

у меня есть скрипт фотогалереи
вот как она выглядит фотогалерея


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

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


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, ".." ) > 0 || 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 ) > 0 )
{
    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 ) > 0 )
{
    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 ) > 0 )
{
    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();
    }
?>
 
Ответить с цитированием
 



Предыдущая тема Следующая тема
Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Ищу скрипт mlm пирамиды... Linuxoid PHP 9 04.06.2008 12:50
Комплекс SEO-master baltazar SЕО - тонкости, методы раскрутки 1 18.04.2008 16:09



Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT ™ © 2001- Antichat Kft.