在目录中显示图片
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在目录中显示图片相关的知识,希望对你有一定的参考价值。
[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
<?php $width = 100; $height = 100; $pageTitle = "Pictures"; // ************************************************************* $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> <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>
以上是关于在目录中显示图片的主要内容,如果未能解决你的问题,请参考以下文章
Swift新async/await并发中利用Task防止指定代码片段执行的数据竞争(Data Race)问题
在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途