开发者

dynamically display images in a grid in html

The setup is as follows:

I have 25 folders, with each folder having some images. The number and filenames of images in each folder is decided after I run a C++ code. I want to display the images in these 25 folders in a 5x5 grid format in an html file with the size of each grid entry depending upon the number of images in the folder corresponding to that grid entry. I need to write an html script for it.

Since I have absolutely no experience in writing html scripts, I looked at some of the other posts in stackoverflow and elsewhere, but I could not find help on dynamically looking up folders and then displaying the images they contain. I would really appreciate if someone could help me on that.

开发者_C百科Thanks in advance!


As Zeychin says, you could use PHP to nicely and efficiently output HTML based on the query you make to those directories you've setup.

Look into PHP's $_SERVER and from that you should be able to query anything on the server form the root name to the contents of folders. Deal with the data it returns to you and through looping you can easily output a tabular format which would roughly resemble the following

<table><!-- "Starts" table-->
<tr><!-- "Starts" row 1-->
<td><!-- "Starts" cell 1-->
</td><!-- "ends" cell 1-->
<td><!-- "Starts" cell 2-->
</td><!-- "ends" cell 2-->
<td><!-- "Starts" cell 3-->
</td><!-- "ends" cell 3-->
<td><!-- "Starts" cell 4-->
</td><!-- "ends" cell 4-->
<td><!-- "Starts" cell 5-->
</td><!-- "ends" cell 5-->
</tr><!-- "ends" row 1-->

... do this 4 more times ...

</table> <!-- "end" table-->


This sounds like a server-side script best implemented in PHP/JSP, et cetera. I'm rusty with my server-side stuff, so I'll leave this to those who are more familiar with the server-side material.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜