我尝试在不使用任何库的情况下编写图像库。我想将14个jpg文件作为"uniq_image"实例上传到公共图像"moving_image"中。我只成功上传了3个jpg文件,因为在css中为"td"类设置了"overflow:hidden"。
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"定义。