Return to Snippet

Revision: 5646
at March 22, 2008 08:24 by kyokutyo


Updated Code
<?php
$fileTypes = array('jpg','jpeg','gif','png');
$width = 100;
$height = 100;
$pageTitle = "Pictures";

// *************************************************************

$f = join(',*.', $fileTypes);
$f = '*.'.$f;
$height += 20;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title><?php echo $pageTitle; ?></title>
<style type="text/css">
<!--
* { margin:0; padding:0; }
h1 { background:#eee; font-weight:normal; padding:3px 5px; font-size:medium; }
ul { margin-top:10px; list-style:none; }
ul li { width:<?php echo $width; ?>px; height:<?php echo $height; ?>px; float:left; padding:5px; overflow:hidden; margin-bottom:10px; }
ul li span { height:20px; font-size:medium; font-style:italic; }
ul li a img { width:<?php echo $width; ?>px; border:dotted 1px #ddd; }
-->
</style>
  </head>
  <body>
    <h1><?php echo $pageTitle; ?></h1>
    <ul>
<?php $loop = 1; foreach (glob("{".$f."}", GLOB_BRACE) as $fileName) { ?>
      <li>
        <span><?php echo $loop; ?></span>
        <a href="<?php echo $fileName; ?>" target="_blank"><img alt="<?php echo $fileName; ?>" src="<?php echo $fileName; ?>" /></a>
      </li>
<?php $loop++; } ?>
    </ul>
  </body>
</html>

Revision: 5645
at March 22, 2008 07:54 by kyokutyo


Updated Code
<?php
$fileTypes = array('jpg','jpeg','gif','png');
$width = 100;
$height = 100;
$pageTitle = "Pictures";

// *************************************************************

$f = join(',*.', $fileTypes);
$f = '*.'.$f;
$height += 20;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title><?php echo $pageTitle; ?></title>
<style type="text/css">
<!--
* { margin:0; padding:0; }
h1 { background:#eee; font-weight:normal; padding:3px 5px; font-size:medium; }
ul { margin-top:10px; list-style:none; }
ul li { width:<?php echo $width; ?>px; height:<?php echo $height; ?>px; float:left; padding:5px; overflow:hidden; margin-bottom:10px; }
ul li span { height:20px; font-size:medium; font-style:italic; }
ul li a img { width:<?php echo $width; ?>px; border:dotted 1px #ddd; }
-->
</style>
  </head>
  <body>
    <h1><?php echo $pageTitle; ?></h1>
    <ul>
<?php $loop = 1; foreach (glob("{ $f }", GLOB_BRACE) as $fileName) { ?>
      <li>
        <span><?php echo $loop; ?></span>
        <a href="<?php echo $fileName; ?>" target="_blank"><img alt="<?php echo $fileName; ?>" src="<?php echo $fileName; ?>" /></a>
      </li>
<?php $loop++; } ?>
    </ul>
  </body>
</html>

Revision: 5644
at March 22, 2008 07:39 by kyokutyo


Initial Code
<?php
$fileTypes = array('jpg','jpeg','gif','png');
$width = 100;
$height = 100;
$pageTitle = "Pictures";

// *************************************************************

$f = join(',*.', $fileTypes);
$f = '*.'.$f;
$height += 20;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=euc-jp" />
    <title><?php echo $pageTitle; ?></title>
<style type="text/css">
<!--
* { margin:0; padding:0; }
h1 { background:#eee; font-weight:normal; padding:3px 5px; font-size:medium; }
ul { margin-top:10px; list-style:none; }
ul li { width:<?php echo $width; ?>px; height:<?php echo $height; ?>px; float:left; padding:5px; overflow:hidden; margin-bottom:10px; }
ul li span { height:20px; font-size:medium; font-style:italic; }
ul li a img { width:<?php echo $width; ?>px; border:dotted 1px #ddd; }
-->
</style>
  </head>
  <body>
    <h1><?php echo $pageTitle; ?></h1>
    <ul>
<?php $loop = 1; foreach (glob("{ $f }", GLOB_BRACE) as $fileName) { ?>
      <li>
        <span><?php echo $loop; ?></span>
        <a href="<?php echo $fileName; ?>" target="_blank"><img alt="<?php echo $fileName; ?>" src="<?php echo $fileName; ?>" /></a>
      </li>
<?php $loop++; } ?>
    </ul>
  </body>
</html>

Initial URL

                                

Initial Description
[directory]
 ├index.php //this snippet
 ├imageA.jpg
 ├imageB.gif
 â””imageC.png

This snipet displays the thumbnail of the picture file that exists in the 
same directory. 
When the thumbnail image is clicked, the original size image is displayed. 

options:
 filetype, width, height, pagetitle

Initial Title
Display pictures in the directory

Initial Tags
list, image

Initial Language
PHP