如何将jpg文件上传到一个常见的长水平图像中


How can I upload jpg files into one common long horizontal image?

我写了一个图像库,不使用任何库。我从特定目录上传jpg文件。我想将上传的"uniq_image"图像组装成一个长的水平图像"moving_image),以便将它们滚动到一起

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;
    overflow:hidden;
}
//the style for each uploaded image from the file
#uniq_image {
    background-repeat: no-repeat;
    border:1px solid blue;
    width: 150px;
    height: 120px;
    overflow:hidden;
}

包含php上传代码的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.'" style="uniq_image" >';
             }
            $dir->close();
          ?>
      </div>
<td>

我在这里想念什么?谢谢

您似乎只缺少了一些基础知识。

您应该用.uniq_image定义一个类样式。#uniq_image是一个ID的规则,不能有多个元素具有相同的ID。

并将style="uniq_image"更改为class="uniq_image"style属性用于定义内联样式规则。

可能还有其他问题,但从这些变化开始。此外,在开始实施这样的东西之前,请考虑更多的阅读,因为你把所有的东西都搞混了。