php - 如何将jpg文件上传到一张普通的长横图?

标签 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>

我在这里错过了什么?谢谢。

最佳答案

您似乎只缺少基础知识。

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

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

可能还有其他问题,但从这些更改开始。另外,在开始实现此类内容之前,请考虑多读一些书,因为您把所有内容都搞混了。

关于php - 如何将jpg文件上传到一张普通的长横图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9039116/

相关文章:

html - 在父元素中间居中文本

php - SQL 代码点火器 : Create savepoint and roll-back to the savepoint/Rollback multiple transaction from controller

php - Wordpress - 如果当前页面处于事件状态,则添加 "active"类

Javascript - 圆与圆碰撞问题

android - jQuery mobile + phonegap select 元素显示选项很慢

html - 无法从菜单中悬停第二个 ul

html - 在 CSS 或 canvas 中绘制一条曲线,并沿其移动圆圈

php - mysql 中链接表的更有效方法

php - 正确使用 glob()

java - Spring Boot 2 中的映射资源