PHP 修改“在目录中显示图片”由kyokutyo

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 修改“在目录中显示图片”由kyokutyo相关的知识,希望对你有一定的参考价值。

<?php
$path = "logoimages/";
 $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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Pictures</title>
<style type="text/css">
      <!--
 
      .gallery ul { margin-top:10px; list-style:none; }

      .gallery ul li { width:<?php echo $width; ?>px; height:<?php echo $height; ?>px; float:left; padding:5px; overflow:hidden; margin-bottom:10px; }
 
      .gallery ul li span { height:20px; font-size:medium; font-style:italic; }

      .gallery ul li a img { width:<?php echo $width; ?>px; border:dotted 1px #ddd; }

      -->
</style>
</head>

<body>


<div id="wrapper">
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero. Vivamus pharetra posuere sapien. Nam consectetuer. Sed aliquam, nunc eget euismod ullamcorper, lectus nunc ullamcorper orci, fermentum bibendum enim nibh eget ipsum. Donec porttitor ligula eu dolor. Maecenas vitae nulla consequat libero cursus venenatis. Nam magna enim, accumsan eu, blandit sed, blandit a, eros.</p>
       
       <div class="gallery" style="display:block; width:100% clear:both;">   
          <ul>

<?php $loop = 1; foreach (glob("$path{".$f."}", GLOB_BRACE) as $fileName) { ?>
 
      <li>

      <a href="<?php echo $fileName; ?>"><img alt="<?php echo $fileName; ?>" src="<?php echo $fileName; ?>" /></a>

      </li>

      <?php $loop++; } ?>
      </ul>
      </div><!-- END GALLERY-->
</div>
<!--END WRAPPER -->

</body>
</html>

以上是关于PHP 修改“在目录中显示图片”由kyokutyo的主要内容,如果未能解决你的问题,请参考以下文章

在目录中显示图片

php环境之Wampserver端口修改

PHP 被设置为移除内联块,这将导致多个核心应用无法访问。 这可能由缓存/加速器导致的,例如 Zend OPcache 或 eAccelerator。

由 CSRF 引起的 XSS 漏洞小结

PhpStrom调试,由XDebug提供支持

PHP知识点复习