简体   繁体   English

使用服务器上的HTML / js在网页上显示图像

[英]Display images on webpage using HTML/js from server

I've to display some images on my webpage that are stored on my server. 我必须在网页上显示一些存储在服务器上的图像。 The no. 没有 of images is not fixed so I am confused that how should I construct the tags in my client side code to display those images in HTML or javascript. 的图片数量不固定,因此我感到困惑,应该如何在客户端代码中构建标记以使用HTML或javascript显示这些图片。 I am trying this in PHP but its not working:- 我正在PHP中尝试此操作,但无法正常工作:-

foreach(glob($strPath."/".$FileName."/*.jpg") as $f)
{
echo "<img src='../MyPP/".$f."'/>";
}

It displays nothing and I can't get the image in JS for manipulation. 它什么也不显示,我无法在JS中获取图像进行操作。 I think this is not very difficult problem but I am newbie to web so I've not much knowledge of HTML and JS. 我认为这不是一个很困难的问题,但是我是Web的新手,所以我对HTML和JS的了解不多。 Please suggest an easiest way to do this in HTML/JS (avoid ajax/jquery etc. if possible). 请提出在HTML / JS中执行此操作的最简单方法(如果可能,请避免使用ajax / jquery等)。 I would really gratefull for any help. 我真的很感激任何帮助。 Thanks. 谢谢。

Try; 尝试;

foreach(glob($strPath."/".$FileName."/") as $f){
    echo "<img src='../MyPP/".$f.".jpg'/>";
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM