gpt4 book ai didi

php - 从文件加载 php 图像的 css 中的图像大小

转载 作者:行者123 更新时间:2023-11-28 00:30:20 25 4
gpt4 key购买 nike

我正在尝试添加 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>

最佳答案

css不能控制图片,只能添加样式(比如比他父级小一半,20%亮度,蓝色边框等等)但是你不能操作它。

为了使 Google 中的此搜索成为一个用于在 PHP 中调整大小或剪切图像的脚本。但在砌体中这没有意义,砌体的魔力在于使任何尺寸适应任何布局(通过 Javascript)。

关于php - 从文件加载 php 图像的 css 中的图像大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54439565/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com