【发布时间】:2019-01-30 11:28:25
【问题描述】:
我正在尝试添加 css 代码来处理从文件源自动加载的图像大小。我正在使用 php scrpt 加载图像并且它正在工作,但我无法使用 css 为响应式站点更改图像的大小。我正在使用砖石来显示图像,这又是有效的。
我正在展示正在运行的 php。我需要帮助来处理 .project 中图像的大小
<div class='project'>
<?php
// Image extensions
$image_extensions = array("png","jpg","jpeg","gif");
// Target directory
$dir = 'img/';
if (is_dir($dir)){
if ($dh = opendir($dir)){
$count = 1;
// Read files
while (($file = readdir($dh)) !== false){
if($file != '' && $file != '.' && $file != '..'){
// Image path
$image_path = "img/".$file;
$image_ext = pathinfo($image_path, PATHINFO_EXTENSION);
// Check its not folder and it is image file
if(!is_dir($image_path) &&
in_array($image_ext,$image_extensions)){
?>
<!-- Image -->
<img src="<?php echo $image_path; ?>" alt="" title=""/>
</a>
<!-- --- -->
<?php
}
}
}
closedir($dh);
}
}
?>
</div>
【问题讨论】: