这样的图片如何调用嵌入到其他网页里去???????请高手帮忙。(不要iframe)

z8h8y8 2006-05-05 01:27:48
这样的图片如何调用嵌入到其他网页里去???????请高手帮忙。(人在可马上给分!)

这段代码所在文件是:pic.asp,图片访问方式为:pic.asp?id=1
id是图片的序号,我想在另一个页面中(注:这个页是asp页)中调用该图片(注:不想用iframe调用),请问高手如何实现,目前这样试过:<script src="pic.asp?id=1"></script>,失败!
<%
function readbinfile(path)
dim objstream,bin
set objstream = server.createobject("adodb.stream")
objstream.open
objstream.type = 1
objstream.loadfromfile path
bin = objstream.read
objstream.close
readbinfile = bin
end function

dim id:id = trim(request("id"))
dim rs,sql
if id = "" or not isnumeric(id) then
response.redirect("index.asp")
end if
set rs = server.createobject("adodb.recordset")
sql = "select * from photo where pid=" & id
rs.open sql,conn,1,1
if rs.eof then
response.write("<script>alert(""非常抱歉!暂时还没有图片!"");this.location.href=""index.asp"";</script>")
else
dim filepath,path,bin
filepath = rs("filepath")
path = server.mappath("" & filepath & "")
bin = readbinfile(path)
response.contenttype = "image/jpeg"
response.binarywrite(bin)
rs.close
set rs = nothing
end if
%>
...全文
194 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
lisoon 2006-05-05
  • 打赏
  • 举报
回复
在pic.asp页面这样
response.redirect("picture_path/test.jpg")

调用<image src="pic.asp?id=1">
z8h8y8 2006-05-05
  • 打赏
  • 举报
回复
谢谢,不知道你明白我的意思没有?我想把pic.asp这个文件执行的结果(也就是读的图片)调用到其他页中,如果像这样:document.write("<img src='<%=request("id")%).gif>")
改的话,和直接调用图片没什么区别吧?为了隐藏图片地址,我可是特意用adodb.stream读的图片哦。
z8h8y8 2006-05-05
  • 打赏
  • 举报
回复
这就是pic.asp里面的代码了。
<%
function readbinfile(path)
dim objstream,bin
set objstream = server.createobject("adodb.stream")
objstream.open
objstream.type = 1
objstream.loadfromfile path
bin = objstream.read
objstream.close
readbinfile = bin
end function

dim id:id = trim(request("id"))
dim rs,sql
if id = "" or not isnumeric(id) then
response.redirect("index.asp")
end if
set rs = server.createobject("adodb.recordset")
sql = "select * from photo where pid=" & id
rs.open sql,conn,1,1
if rs.eof then
response.write("<script>alert(""非常抱歉!暂时还没有图片!"");this.location.href=""index.asp"";</script>")
else
dim filepath,path,bin
filepath = rs("filepath")
path = server.mappath("" & filepath & "")
bin = readbinfile(path)
response.contenttype = "image/jpeg"
response.binarywrite(bin)
rs.close
set rs = nothing
end if
%>
nowheart 2006-05-05
  • 打赏
  • 举报
回复
z8h8y8(小虾米) ( ) 信誉:100 2006-05-05 02:17:00 得分: 0


好象不行吧?因为是用二进制读取的图片,浏览器访问pic.asp?id=1这个的时候,图片直接显示出来,没有<img src="xxx.gif">,就是单纯一张图片,可以另存,但是看不到图片的地址的。



————————————————————
只是地址加密了~~其实还是有图片的~~
照我上面改是可以的~~因为各大统计都是这样做~
z8h8y8 2006-05-05
  • 打赏
  • 举报
回复
看不到html源代码的。
z8h8y8 2006-05-05
  • 打赏
  • 举报
回复
好象不行吧?因为是用二进制读取的图片,浏览器访问pic.asp?id=1这个的时候,图片直接显示出来,没有<img src="xxx.gif">,就是单纯一张图片,可以另存,但是看不到图片的地址的。
nowheart 2006-05-05
  • 打赏
  • 举报
回复
调用时还是这样<script src="pic.asp?id=1"></script>
nowheart 2006-05-05
  • 打赏
  • 举报
回复
改一下pic.asp中的代码~用JS来显示~
参考各大统计的统计页面~
如:
document.write("<img src='<%=request("id")%).gif>")

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧