Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't show an image with this routine

Status
Not open for further replies.

hceco

MIS
Mar 18, 2008
37
BR
I have the routine below but can't find the problem. See that ok is printed, so the path is correct.

Code:
<%
	On Error Resume Next
	
	dim fso
	
	set fso = Server.CreateObject("Scripting.FileSystemObject")
	
	if fso.FileExists(fso.getFolder("c:\inetpub\websci\image\SVM\") & "\" & request("produto") & ".jpg") Then
		response.write "ok"
		response.write("<img width=100% src=image/SVM/" & request("produto") & ".jpg>")
		response.write("<br><br><div align=center class=textopreto>" & request("produto") & "</div>")

	Else
		response.write("<div align=center class=erro>The product " & request("produto") & " is not available!!</div>")
		response.write("<br><br><div align=center><a class=button href=javascript:this.close()>Close</a></div>")
	End If
	
	set fso = nothing
	
	If Err.Number <> 0 Then
		response.write("<div align=center class=erro>Page error</div>")
	End If
%>


thanks.
 
do you at least get the x wrapped in a box that represents an image not found?

Does you image name have spaces in it? If so, you need to wrap the src in quotes (single quotes will do).

Is the page this code is on located in the same directory tree as the image: c:\inetpub\websci\ ?

TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
vic covered this fairly well. here's a couple other touch ups, and a little more detail on the directory tree question of his:

techincally fso.fileexists will take a path so you dont need to getfolder.

secondly:
response.write("<img width=[red]"100%"[/red] src=image/SVM/" & request("produto") & ".jpg>")
is the location this script running from the root, the websci sub, or elsewhere? also percentages will sometimes get grumpy outside of quotes

more than likely i'm guessing you need to update the full relative path to either /websci/image/SVM or /image/SVM depending on your root structure


as noted earlier vic did a fine job here if you're gonna star any one pick vic


[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
" I always think outside the 'box', because I'm never in the 'loop' " - DreX 2005
 
I looked google and another fonts for the solution, but no success so I posted here.

The code is right. The problem is image: need to be in the RGB mode instead off CMYK.

thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top