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

时间:2012-01-27 19:45:41

标签: php html css

我写了一个图库,我不使用任何库。我从特定目录上传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>

我在这里想念什么?感谢。

1 个答案:

答案 0 :(得分:1)

你只缺少它看似的基础知识。

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

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

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