Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2003, 02:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default image display problem

Hi all

Please guide how can display the image file which is save in ACCESS database.file name is

$(ROOTDIR)\CONTRACT\CONTRACT-164.TIF


Response.Write("<tr>")
Response.Write("<a href=" & server.HTMLEncode(rs("imagename")) & " >" & rs("imagename") & "</a>")
Response.Write("</tr>")

Thanks for help.

regards.

Mateen Martin
[email protected]
 
Old June 5th, 2003, 09:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

a) What do you have in your Access database? Just the image file's path? or the actual binary data?
b) Your HTML is *not* valid. You can not place text inside a <tr></tr> element. You need to create a <td></td> element nested inside your <tr></tr> element, and place your text inside that. You can validate your HTML at: http://validator.w3.org/

Cheers
Ken
 
Old June 7th, 2003, 12:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply,
I will validate my html page at this sit
I am using ACCESS database.

It is the probem that I save only image name but Orbit Front software save the image name at the access databse like this

$(ROOTDIR)/CONTRACT/IMAGENAME.TIF

I required happer link on the image file, and run the asp file on explorer.

Please correct my following asp coding.

<html>
<HEAD>
</HEAD>
<BODY>

<form method=post action=wpls.asp id=form name=form>
<%

set cn=server.CreateObject("adodb.connection")
cn.ConnectionString="Provider=SQLOLEDB.1;Integrate d Security=SSPI;Persist Security Info=False;Initial Catalog=dcil;Data Source=AUHTRIPSVR2"
cn.Open

contractno=Request.QueryString("contractno")
contractno=Request.Form("contractno")

recordid=Request.Form("recordid")


ssql="SELECT * FROM archive2 where contractno='" &contractno & "'"

'Record Set
set rs=cn.Execute(ssql)

%>
<TABLE border=1 bordercolorlight="#669999" bordercolordark="#330066">
<tr bgcolor=gold>
<th>Contract No</th>
<th>Record Drawing No</th>
<th>Drawing No</th>
<th>ImageReference</th>
</tr>

<%


do while rs=false then

Response.Write("<tr>")
Response.Write("<td bgcolor=lightyellow>" & rs("contractno") & "</td>")
Response.Write("<td>" & rs("recordno") & "</td>")
Response.Write("<td>" & rs("drawingno") & "</td>")

Response.Write("<td>")
Response.Write("<a href=" & server.URLEncode(rs("imagereference")) & ">" & rs("imagereference") & "</a>")
Response.Write("</td>")
Response.Write("<tr>")

rs.movenext
loop
%>

</TABLE>


<INPUT id=submit2 name=submit2 type=submit value="Back" target=Right>
</P>
</BODY>
</HTML>

</body>


best regards.
Mateen Martin
[email protected]






Quote:
quote:Originally posted by KenSchaefer
 a) What do you have in your Access database? Just the image file's path? or the actual binary data?
b) Your HTML is *not* valid. You can not place text inside a <tr></tr> element. You need to create a <td></td> element nested inside your <tr></tr> element, and place your text inside that. You can validate your HTML at: http://validator.w3.org/

Cheers
Ken
 
Old June 11th, 2003, 02:51 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for your response.

There is any other method / way that I could display images / drawings. Images are save on ACCESS DATABASE with $ sign and sub directory, like this.

$ROOTDIR)/CONTRACT/IMAGENAME.TIF

Or there are any function / procedure / query which will only display imagename and
ignore $(ROOTDIR) ie.

LTRIM, REPLACE, STR etc.. please help.

please check my coding..
when I click the haper link the image should display.
it is not display.

<html>
<HEAD>
</HEAD>
<BODY>

<form method=post action=wpls.asp id=form name=form>
<%

set cn=server.CreateObject("adodb.connection")
cn.ConnectionString="Provider=SQLOLEDB.1;Integrate d Security=SSPI;Persist Security Info=False;Initial Catalog=dcil;Data Source=AUHTRIPSVR2"
cn.Open

contractno=Request.QueryString("contractno")
contractno=Request.Form("contractno")

recordid=Request.Form("recordid")

if rs="" then
rs="-"
end if


ssql="SELECT * FROM archive2 where contractno='" &contractno & "'"

'Record Set
set rs=cn.Execute(ssql)

%>
<TABLE border=1 bordercolorlight="#669999" bordercolordark="#330066">
<tr bgcolor=gold>
<th>Contract No</th>
<th>Record Drawing No</th>
<th>Description</th>
<th>Drawing Category</th>
<th>Contractor</th>
<th>Consultant</th>
<th>Drawing No</th>
<th>ImageReference</th>
<th>Window_x1</th>
<th>Window_y1</th>
<th>Window_x2</th>
<th>Window_y2</th>
</tr>

<%

do while NOT rs.EOF

Response.Write("<tr>")
Response.Write("<td bgcolor=lightyellow>" & rs("contractno") & "</td>")
Response.Write("<td>" & rs("recordno") & "</td>")
Response.Write("<td>" & rs("description") & "</td>")
Response.Write("<td>" & rs("category") & "</td>")
Response.Write("<td>" & rs("contractor") & "</td>")
Response.Write("<td>" & rs("consultant") & "</td>")
Response.Write("<td>" & rs("drawingno") & "</td>")

Response.Write("<td>")
Response.Write("<a href=" & server.URLEncode(rs("imagereference")) & ">" & rs("imagereference") & "</a>")
Response.Write("</td>")

Response.Write("<td>" & rs("window_x1") & "</td>")
Response.Write("<td>" & rs("window_y1") & "</td>")
Response.Write("<td>" & rs("window_x2") & "</td>")
Response.Write("<td>" & rs("window_y2") & "</td>")


Response.Write("<tr>")
rs.movenext
loop
%>
</TABLE>

<INPUT id=submit2 name=submit2 type=submit value="Back" target=Right>
</P>
<P>&nbsp;</P>
</BODY>
</HTML>

</body>

regards.

Mateen Martin
[email protected]




Quote:
quote:Originally posted by KenSchaefer
 a) What do you have


in your Access database? Just the image file's path? or the actual binary data?
b) Your HTML is *not* valid. You can not place text inside a <tr></tr> element. You need to create a <td></td> element nested inside your <tr></tr> element, and place your text inside that. You can validate your HTML at: http://validator.w3.org/

Cheers
Ken
 
Old June 11th, 2003, 07:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

Well,
Your questions aren't precisely, so I suppose that you retreive from DB something like this

image_save_url="C:\InetPub\wwwroot\application_nam e\contract\CONTRACT-164.TIF"

If you want to display an image and/or create a hyperlink you can extract only image name with par example,

array_extract=split(image_save_url,"\")
only_image=array_extract(5)
image_url="/contract/" & array_extract(5)
etc..

Variable image_url you can use to either display an image or create an appropriate hyperlink...

If I don't understand, please be more concientous and send exactly value for image you retreived from db (add one Response.Write rs("imagereference")).

Regs,
NotNowJohn

...but the Soon is eclipsed by the Moon
 
Old June 14th, 2003, 02:48 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your response.
Please check my coding.
I run following page trip.asp

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 5.0">

<form method=post action=contno2.asp id=contractno name=contractno>


<TABLE cellSpacing=1 cellPadding=1 width="674" border=1 bordercolorlight="#CCCCCC" bordercolordark="#666666">



  <TR>

    <TD width="161">Contract No :</TD>

    <TD width="377"><SELECT id=contractno name=contractno> <OPTION selected>
<%
dim ssql

set cn=server.CreateObject("adodb.connection")

cn.ConnectionString="Provider=SQLOLEDB.1;Integrate d Security=SSPI;Persist Security Info=False;Initial Catalog=dcil;Data Source=AUHTRIPSVR2"
cn.Open

ssql="select distinct contractno from arc order by contractno"

set rs=cn.Execute(ssql)

do while rs.eof=false

Response.Write("<option value='" & rs("contractno") & "'>")
Response.Write(rs("contractno") )
rs.movenext
loop
%>



  </OPTION></SELECT><INPUT style="WIDTH: 48px; HEIGHT: 24px" type=submit size=16 value=search id=submit1 name=submit1></TD></TR>
</form>

    </TD></TR></TABLE>



</P>
</form>



</BODY>
</HTML>


It move to contno2.asp page and coding is following

<html>
<head>
</head>


<body background="images/netbkgnd.gif" bgcolor="#FFFFFF" text="#000000" link="#0066CC" vlink="#999999" alink="#669999">



<%@ Language=VBScript %>

<HTML xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/TR/REC-html40">

<HEAD>

<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

<link rel="File-List" href="contno_files/filelist.xml">

</HEAD>
<BODY background="images/netbkgnd.gif" bgcolor="#FFFFFF" text="#000000" link="#0066CC" vlink="#999999" alink="#669999">
<form method=post action=wpls5.asp id=form name=form>
<%


set cn=server.CreateObject("adodb.connection")

cn.ConnectionString="Provider=SQLOLEDB.1;Integrate d Security=SSPI;Persist Security Info=False;Initial Catalog=dcil;Data Source=AUHTRIPSVR2"

cn.Open



contractno=Request.QueryString("contractno")
contractno=Request.Form("contractno")

ssql="SELECT * FROM arc where contractno='" &contractno & "'"



'Record Set

set rs=cn.Execute(ssql)

%>

<TABLE border=1 bordercolorlight="#669999" bordercolordark="#330066">

<tr bgcolor=gold>

<th>Contract No</th>

<th>Record Drawing No</th>

<th>Description</th>

<th>Drawing Category</th>

<th>Contractor</th>

<th>Consultant</th>

<th>Drawing No</th>

<th>ImageReference</th>

<th>Window_x1</th>

<th>Window_y1</th>

<th>Window_x2</th>

<th>Window_y2</th>

<th>approvedate</th>
</tr>
<%

do while rs.eof=false

Response.Write("<tr>")
Response.Write("<td bgcolor=lightyellow>" & rs("contractno") & "</td>")
Response.Write("<td>" & rs("recordno") & "</td>")
Response.Write("<td>" & rs("description") & "</td>")
Response.Write("<td>" & rs("category") & "</td>")
Response.Write("<td>" & rs("contractor") & "</td>")
Response.Write("<td>" & rs("consultant") & "</td>")
Response.Write("<td>" & rs("drawingno") & "</td>")
Response.Write("<td>")
Response.Write("<a href=" & server.URLEncode(rs("imagereference")) & ">" & rs("imagereference") & "</a>")
Response.Write("</td>")
Response.Write("<td>" & rs("window_x1") & "</td>")
Response.Write("<td>" & rs("window_y1") & "</td>")
Response.Write("<td>" & rs("window_x2") & "</td>")
Response.Write("<td>" & rs("window_y2") & "</td>")


Response.Write("<tr>")

rs.movenext
loop

%>

</TABLE>



<INPUT id=submit2 name=submit2 type=submit value="Back" target=Right>

</P>
<P>&nbsp;</P>
</BODY>
</HTML>


</body>

</html>


and display image hiper link like following

 $(ROOTDIR)\contract21M\21M-067.tif
 $(ROOTDIR)\contract21M\21M-082.tif
 $(ROOTDIR)\contract21M\21M-042.tif


My problem is in imagereference column.

It is showing $(ROOTDIR)\contractno21m\21m-067.tif

When I click the imagereference column to display the image, it not display the image.

I using localhost.

Due to $ sign and subdirectory it image not display.

How I can display the image ?

How I can remove $ sign and sub directory from the imagereference column so that only image name display,

And when I click the imagereference column, the image will display ?
image are save in d:\cather\images directory

I enter image name by the Pro-OrbitFront software, I enter only image name but software save the image name in

the access database like this

$(ROOTDIR)/CONTRACT21M/21M-067.TIF

all records and imagereference value are retrieving from the ACCESS database

Please help, how can image display ?

thanks for your guidance

Mateen Martin
[email protected]




Quote:
quote:Originally posted by NotNowJohn
 Well,
Your questions aren't precisely, so I suppose that you retreive from DB something like this

image_save_url="C:\InetPub\wwwroot\application_nam e\contract\CONTRACT-164.TIF"

If you want to display an image and/or create a hyperlink you can extract only image name with par example,

array_extract=split(image_save_url,"\")
only_image=array_extract(5)
image_url="/contract/" & array_extract(5)
etc..

Variable image_url you can use to either display an image or create an appropriate hyperlink...

If I don't understand, please be more concientous and send exactly value for image you retreived from db (add one Response.Write rs("imagereference")).

Regs,
NotNowJohn

...but the Soon is eclipsed by the Moon
 
Old June 17th, 2003, 04:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

Quote:
quote:It is showing $(ROOTDIR)\contractno21m\21m-067.tif
...
How I can remove $ sign and sub directory from the imagereference column so that only image name display,
The variable only_image contains an image name.
Code:
image_save_url=rs("imagereference") 
array_extract = Split(image_save_url, "\")
only_image = array_extract(2)
And in order to display images they must exist on the server and you have to know the path from your web app directory to the image directory.

Example:
if your web app's dir is C:\InetPub\wwwroot\yourwebapp, it would be good that you save images into C:\InetPub\wwwroot\yourwebapp\autocad_images directory instead of d:\cather\images.
Then, you can display an image as:
image_url="images/" & only_image
<img src=<%=image_url%>>

HTH.


...but the Soon is eclipsed by the Moon
 
Old June 19th, 2003, 03:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for your cooperation

I try your coding but it give error

Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/dcil/contno3.asp, line 136, column 37
Response.Write("<img src=<%=image_url

How I can write / ajust your code

image_url="images/" & only_image
<img src=<%=image_url%>>

in the following my coding

Response.Write("<td>")
Response.Write("<a href=" & server.URLEncode(rs("imagereference")) & ">" & rs("imagereference") & "</a>")
Response.Write("</td>")


I want to use server.URLEncode so that it could be magnified the images.
In use of <img src= tag it not magnify the image

Best regards.

Mateen Martin


quote]Originally posted by NotNowJohn


 
Quote:
quote:It is showing $(ROOTDIR)\contractno21m\21m-067.tif
Quote:
...
How I can remove $ sign and sub directory from the imagereference column so that only image name display,
The variable only_image contains an image name.
Code:
image_save_url=rs("imagereference") 
array_extract = Split(image_save_url, "\")
only_image = array_extract(2)
And in order to display images they must exist on the server and you have to know the path from your web app directory to the image directory.

Example:
if your web app's dir is C:\InetPub\wwwroot\yourwebapp, it would be good that you save images into C:\InetPub\wwwroot\yourwebapp\autocad_images directory instead of d:\cather\images.
Then, you can display an image as:
image_url="images/" & only_image
<img src=<%=image_url%>>

HTH.


...but the Soon is eclipsed by the Moon
[/quote]
 
Old June 28th, 2003, 04:12 AM
Authorized User
 
Join Date: Jun 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

1) web browser di not show TIF file, use GIF, JPG, or BMP

create a virtual directory under your app folder and point to CONTRACT in
$(ROOTDIR)\CONTRACT\CONTRACT-164.JPG

'assume your app folder is "WebApp" then if you type in address box
http://yourserver/WebApp/Contract/Contract-164.jpg
'you must see your image

'Assume rs("imagereference") return
$(ROOTDIR)\CONTRACT\CONTRACT-164.JPG

'Your code will be:
sFileName = Replace( rs("imagereference"), "$(ROOTDIR)\CONTRACT\", "")
Response.Write "<a href=""http://yourserver/WebApp/Contract/" & sFileName & """>" & rs("imagereference") & "</a>"

Khoa Nguyen





Similar Threads
Thread Thread Starter Forum Replies Last Post
Image Display problem ratheesh_param ASP.NET 1.0 and 1.1 Professional 2 November 27th, 2006 01:02 AM
Image Display Problem ratheesh_param ASP.NET 2.0 Professional 0 November 22nd, 2006 03:24 AM
Image Display Problem ratheesh_param ASP.NET 1.x and 2.0 Application Design 0 November 22nd, 2006 03:02 AM
image display problem please help mateenmohd Classic ASP Basics 0 June 7th, 2003 02:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.