我尝试在不使用任何库的情况下编写图片库。我想将 14 个 jpg 文件作为“uniq_image”实例上传到普通图像“moving_image”中。我只成功上传了3个jpg文件的错误,因为在css中为'td'类设置了“溢出:隐藏”。
CSS文件:
//the common long horizontal image that I want to assemble from uniq_images
#moving_image {
background-repeat: no-repeat;
position: relative;
border:1px dashed red;
width: 420px;
height: 130px;
left: 10px;
}
//the style for each uploaded image from the file
.uniq_image {
background-repeat: no-repeat;
border:1px solid gray;
width: 120px;
height: 80px;
margin: 5px 25px 5px 25px;
padding:2px
overflow:hidden;
}
//I set it because I have to fix the cell size
td {
overflow:hidden;
}
html代码:
....
<td width ="420" height="130" overflow="hidden">
<div id= "moving_image" >
<?php
$img_folder = 'picture';
$dir = dir($img_folder);
while (($file = $dir->read()) !== false){
echo '<img src="'.$img_folder."/".$file.'" class="uniq_image" >';
$dir->close();
?>
</div>
<td>
那么,如何修复这个错误并将所有图像上传到“moving_image”?谢谢。
最佳答案
我解决了这个问题。我补充说:
margin-left:-2000px;
width:2000px;
对“moving_image”的定义。
关于php - 上传区域设置为 "overflow:hidden",如何上传所有图片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9040674/