Avatar billede pjorte Nybegynder
02. august 2003 - 10:06 Der er 7 kommentarer og
1 løsning

Foto album script

Hejsa jeg har her på eksperten fundet dette script som lister alle billeder en den mappe den script selv ligge ret smart faktisk, men nu vil jeg gerne spørge om nogen af jer kan se hvor man kan ændre størrelsen på den thumb som den viser vil gerne lave den lidt større!

Her kommer scripet!!!!!!
_______________________________________________________



<?

/// Customization
                            // no directory BELOW this will be viewable
$title='Billeder fra ...';                    // title of table, leave blank to use default
$showfilenames=0;            // showfilenames .. if disabled, and file has no description, name will be used as description.
$openwindow=1;                // open in popup, 1 = true, 0 = false
$showimagesize=1;            // show image height/width   
$thumbnails=1;                // show image thumbnails
$browse=1;                    // allow subdirectory browsing

$filetypes='jpg|gif|png';    // allowable filetypes, seperate with | (to list all files, use '.')
$rootdir='.';                // directory to show images in, '.' will show images in the same dir as the file.


// modify look/layout
$tdcolor="f1f1f1";            // main td color
$tdovercolor="fffff1";    // td mouseover color
$bordercolor="000000";    // table border color
$textcolor="000000";      // td text color
$tablewidth='500';            // width of the table.. you might want to change this to fit your layout better.

// name of imagemagick convert program (and path if required) .. default is 'convert'
// this is used for thumbnails.. if you don't have it, get it installed!
// comment this out if you don't want to use it

// you may have to use the full path

$imconvert='/usr/local/bin/convert';                               

// don't have imagemagick? you can still manually create thumbnails, they should be 80x50 images,
// with the filename image_tedlsthumb.jpg .. they should ALWAYS be jpg. (image.gif , thumbnail would be image_tedlsthumb.jpg)


////
// To use file descriptions, save a plain text file named FILENAME.EXT.desc , with the description in it
// for example, to have a description for beach.jpg, you would save your description file as beach.jpg.desc
// .desc files will NOT be listed by this script, even if you have $filetypes set to '.'
 

////////////////////////
// SCRIPT BEGINS HERE
$showdir = ereg_replace("\.\./","",$showdir);
if ($showdir) { $listdir = $rootdir.ereg_replace("\./","",$showdir); } else { $listdir = $rootdir; }

if (!$title) $title = 'Billeder i '.$listdir;

$handle=@opendir($listdir);
if (!$handle) { echo "no directory ('.$listdir.'), dying."; exit(); }

  echo '
  <script language="JavaScript">
  function openl(img,nw,nh) {';
  if ($openwindow == 1) { echo 'window.open(img, nw+nh, "toolbar=no,menubar=no,location=no,scrollbars=no,resize=no,width=" + nw + ",height=" + nh);'; }
  else { echo 'document.location=img;'; }
  echo '}</script> 
  <table bgcolor="'.$bordercolor.'" cellpadding="0" cellspacing="0" border="0"><tr><td>
  <table cellpadding="1" cellspacing="1" width="'.$tablewidth.'">
  <tr><td colspan="3" bgcolor="'.$tdcolor.'" align="center"><font face="verdana" size="1" color="'.$textcolor.'"><b>'.$title.'</b></font></td></tr>';

  // loop through all files, build and sort array
  while (($file = readdir($handle))!==false) {
  $filearray[count($filearray)] = $file;
  }
  asort($filearray); closedir($handle);

  $tmp = split('/',$SCRIPT_FILENAME);
  $docroot = ereg_replace($tmp[count($tmp)-1],'',$SCRIPT_FILENAME);
  chdir($docroot.$listdir);

  // subdirectory browsing   
  if ($browse==1) {
    if ($showdir) {
    $updir = split("/",$showdir);
    $tmp = count($updir)-1;
    $i=0;
    while ($i<$tmp) {
      $back.=$updir[$i].'/';
      $i++;
      }
    $back = substr($back,0,strlen($back)-1);
    echo '<tr><td colspan="3" bgcolor="'.$tdcolor.'" align="center"><font face="verdana" size="1" color="'.$textcolor.'"><b><a href="'.$PHP_SELF.'?showdir='.$back.'">« parent directory</a></b></font></td></tr>';
    }
    foreach ($filearray as $file) {
    if (is_dir($file) && $file != '.' && $file != '..') echo '<tr><td colspan="3" bgcolor="'.$tdcolor.'" align="center"><font face="verdana" size="1" color="'.$textcolor.'"><b><a href="'.$PHP_SELF.'?showdir='.$showdir.'/'.$file.'">'.$file.'</a></b></font></td></tr>';
    }
  }

  // loop all files, and filter file types
  foreach ($filearray as $file) {
  $name = split("\.",$file);
   
  if (eregi($filetypes,$name[count($name)-1]) == true) {
    // get filesize and translate to human readable size
   
    $file_size = filesize($file);
    if ($file_size >= 1073741824) {
      $file_size = round($file_size / 1073741824 * 100) / 100 . "g";
    } elseif ($file_size >= 1048576) {
      $file_size = round($file_size / 1048576 * 100) / 100 . "m";
    } elseif ($file_size >= 1024) {
      $file_size = round($file_size / 1024 * 100) / 100 . "k";
    } else {
      $file_size = $file_size . "b";
    }
   
    unset($fileinfo);
    if (file_exists($file.'.desc')) {
        if ($showfilenames == 1) $fileinfo = '<b>'.$file.'</b><br>';
        $fdesc = fopen ($file.'.desc',r);
        $fileinfo .= fread ($fdesc, filesize ($file.'.desc'));
        fclose ($fdesc);
    } else {
        $fileinfo = '<b>'.$file.'</b> ';
        }
     
    if ($size = @getimagesize($file)) {
      $nw = $size[0] + 23;
      $nh = $size[1] + 23;
      }
      if ($showimagesize == 1) {
      $imagesize = $size[0].'x'.$size[1];
    }
 
  if ($file != '.' && $file != '..' && !ereg('.desc',$file) && !ereg('tedlsthumb',$file)) {
    echo '<tr>';
    // thumbnail handling
    if ($thumbnails==1) {
        if ($imconvert && !file_exists($name[0].'_tedlsthumb.jpg')) exec($imconvert.' -quality 70 -geometry 80X50 '.$docroot.$listdir.'/'.$file.' '.$docroot.$listdir.'/'.$name[0].'_tedlsthumb.jpg');
        if (file_exists($name[0].'_tedlsthumb.jpg')) {
          $thumbnailimg = $listdir.'/'.$name[0].'_tedlsthumb.jpg';
          } else { $thumbnailimg = $listdir.'/'.$file; }
        echo '<td valign="top" bgcolor="'.$tdcolor.'" style="cursor: hand" onclick="openl(\''.$listdir.'/'.$file.'\',\''.$nw.'\',\''.$nh.'\')" onmouseover="a'.ereg_replace("-","",ereg_replace(" ","",ereg_replace('\.','',$file))).'.filters.alpha.opacity=\'100\';" onmouseout="a'.ereg_replace("-","",ereg_replace(" ","",ereg_replace('\.','',$file))).'.filters.alpha.opacity=\'75\';" width="80"><img style="filter:alpha(opacity=80);" id="a'.ereg_replace("-","",ereg_replace(" ","",ereg_replace('\.','',$file))).'" src="'.$thumbnailimg.'" width="80" height="50"></td>';
    }
    $tdwidth = $tablewidth - 130;   
    echo '<td valign="top" width="90" bgcolor="'.$tdcolor.'" align="right" style="cursor: default;"><font face="verdana" size="1" color="'.$textcolor.'">'.$file_size.' '.$name[count($name)-1].' &nbsp; <br>'.$imagesize.' &nbsp; </font></td>
    <td width="'.$tdwidth.'" valign="top" bgcolor="'.$tdcolor.'" onclick="openl(\''.$listdir.'/'.$file.'\',\''.$nw.'\',\''.$nh.'\')" onmouseover="this.style.backgroundColor=\''.$tdovercolor.'\'" onmouseout="this.style.backgroundColor=\''.$tdcolor.'\'" style="padding-left: 8;">
    <font face="verdana" size="1" color="'.$textcolor.'"><a style="color: '.$textcolor.'; cursor: default; text-decoration: none;" href="java script:openl(\''.$listdir.'/'.$file.'\',\''.$nw.'\',\''.$nh.'\')">'.$fileinfo.'</a></font></td>
    </tr>';
      }
  }
}
echo '
</table></td></tr></table>';
?>
Avatar billede erikjacobsen Ekspert
02. august 2003 - 10:14 #1
Prøv at kigge de steder der står 80 og 50
Avatar billede detox Nybegynder
02. august 2003 - 10:20 #2
Her ændret til 120X80:
---------------------
    // thumbnail handling
    if ($thumbnails==1) {
        if ($imconvert && !file_exists($name[0].'_tedlsthumb.jpg')) exec($imconvert.' -quality 70 -geometry 120X75 '.$docroot.$listdir.'/'.$file.' '.$docroot.$listdir.'/'.$name[0].'_tedlsthumb.jpg');
        if (file_exists($name[0].'_tedlsthumb.jpg')) {
          $thumbnailimg = $listdir.'/'.$name[0].'_tedlsthumb.jpg';
          } else { $thumbnailimg = $listdir.'/'.$file; }
        echo '<td valign="top" bgcolor="'.$tdcolor.'" style="cursor: hand" onclick="openl(\''.$listdir.'/'.$file.'\',\''.$nw.'\',\''.$nh.'\')" onmouseover="a'.ereg_replace("-","",ereg_replace(" ","",ereg_replace('\.','',$file))).'.filters.alpha.opacity=\'100\';" onmouseout="a'.ereg_replace("-","",ereg_replace(" ","",ereg_replace('\.','',$file))).'.filters.alpha.opacity=\'75\';" width="120"><img style="filter:alpha(opacity=80);" id="a'.ereg_replace("-","",ereg_replace(" ","",ereg_replace('\.','',$file))).'" src="'.$thumbnailimg.'" width="120" height="80"></td>';
Avatar billede detox Nybegynder
02. august 2003 - 10:21 #3
Hmmm:
-----
    // thumbnail handling
    if ($thumbnails==1) {
        if ($imconvert && !file_exists($name[0].'_tedlsthumb.jpg')) exec($imconvert.' -quality 70 -geometry 120X80 '.$docroot.$listdir.'/'.$file.' '.$docroot.$listdir.'/'.$name[0].'_tedlsthumb.jpg');
        if (file_exists($name[0].'_tedlsthumb.jpg')) {
          $thumbnailimg = $listdir.'/'.$name[0].'_tedlsthumb.jpg';
          } else { $thumbnailimg = $listdir.'/'.$file; }
        echo '<td valign="top" bgcolor="'.$tdcolor.'" style="cursor: hand" onclick="openl(\''.$listdir.'/'.$file.'\',\''.$nw.'\',\''.$nh.'\')" onmouseover="a'.ereg_replace("-","",ereg_replace(" ","",ereg_replace('\.','',$file))).'.filters.alpha.opacity=\'100\';" onmouseout="a'.ereg_replace("-","",ereg_replace(" ","",ereg_replace('\.','',$file))).'.filters.alpha.opacity=\'75\';" width="120"><img style="filter:alpha(opacity=80);" id="a'.ereg_replace("-","",ereg_replace(" ","",ereg_replace('\.','',$file))).'" src="'.$thumbnailimg.'" width="120" height="80"></td>';
Avatar billede pjorte Nybegynder
02. august 2003 - 10:25 #4
jamen det det var det send et svar og du får din point's
Avatar billede detox Nybegynder
02. august 2003 - 10:30 #5
c",)
Avatar billede pjorte Nybegynder
02. august 2003 - 10:45 #6
det ver erikjacobsen der kom med det første rigtig svar!!!
Avatar billede erikjacobsen Ekspert
02. august 2003 - 14:05 #7
så lidt skal jeg da ikke have point for ;)
Avatar billede pjorte Nybegynder
02. august 2003 - 16:34 #8
Så siger en tumpe som mig mange tak.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester