生成动态图像,但不显示它. [英] generate images dynamic but not show it.
本文介绍了生成动态图像,但不显示它.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,这段代码会在我的页面的文件夹中生成所有图像项,但是一切都是真的,只是无法显示图像.
请帮帮我.
谢谢.
Hi this code generate all image items in a folder to my page but everything is true just can not show images.
please help me.
thanks.
int ID = Convert.ToInt32(Request.QueryString["ID"].ToString());
galleryCat = System.IO.Directory.GetDirectories(Server.MapPath(".") + "/Upload/Gallery");
string tempPath = galleryCat[ID];
string[] GalleryItem = System.IO.Directory.GetFiles(tempPath, "*.jp*");
foreach (string strPath in GalleryItem)
Literal1.Text += string.Format("<li><a href='{0}' > <asp:Image ID='Image1' runat='server' CssClass='img' ImageUrl='{0}' /></a></li>", strPath);
推荐答案
我通过更改这部分代码来解决此问题.
i solve this problem by change this part of code.
Literal1.Text += string.Format("<li><a href=""> <img src="{0}" /></a></li>\n", strPath);
Literal1.Text =Literal1.Text.Replace(Server.MapPath("."), "").Replace("\\","/");
这篇关于生成动态图像,但不显示它.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文