 |
| HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the HTML 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
|
|
|
|

June 28th, 2004, 08:28 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
images are displayed (inconsistently)
I am calling images from a folder using FSO. Everything is working fine EXCEPT that the images sometimes appear in a new browser window, and sometimes they don't. I have set up the code so that when the user enters the model number, the code sniffs thru the folder and if that image is found, a hyperlink to that image is displayed (response.write). Once clicked that image pops up in a new browser window. Writing the hyperlinks works fine, tis when the user clicks that hyperlink that the image is sometimes replace by the default (image not available icon).
Any help would greatly be appreciated. Let me know what snippets of code you would need to review, too.
One last note: the images are jpeg but are huge (~1meg). However that doesn't seem to be the problem because some smaller images don't appear and other bigger ones do???
Thanks
|
|

June 28th, 2004, 10:40 PM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
|
|
Why images are being called using FSO, as these images can be
displayed using <IMG tag..
Om Prakash
|
|

June 29th, 2004, 08:13 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am using FSO because the folder I am referring to is constantly growing in its content (number of files). Therefore, with a consistant filenaming convention, I do not have to embed the links onto the HTML page but rather have the code look into folder to find a match.
|
|

June 29th, 2004, 08:17 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
|
|
Hi,
Can you paste the code, which actually displays the image and writes the <A... tag
Om Prakash
|
|

June 29th, 2004, 08:35 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sure, here it is:
Of course "modelhr" is the name of the textfield in the form:
**********************************************
<%
dim fsohr
dim pichrurl
dim strpath1
dim modelhr
dim modelhrpic
dim gethrpic
modelhr=Request.Form("modelhr")
if modelhr<>"" Then
'this code checks the existance of a image file to display the product image
'================================================= ===============
Set fsohr = CreateObject("Scripting.FileSystemObject")
pichrurl="\img\hires\" & modelhr & ".jpg"
strpath1=Server.MapPath(pichrurl)
If (fsohr.FileExists(strpath1)) Then
Response.Write("<P class=""locator"" style=""margin-bottom: -10px;""> <img src=""../img/icon.gif""> <a href="""&pichrurl&""" target=_blank class=""locator"" title="""&modelhr&""" image"">"""&modelhr&""" image</a></P>" )
Else
Response.Write("<P class=""locator"" style=""margin-top: -5px;"">"""&modelhr&""" image unavailable</P>" )
End If
end if
%>
**********************************************
|
|

July 9th, 2004, 10:18 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I've checked this section (FSO) in ASP.3.0 For Beginner's but couldn't find an explanation for this inconsistent behaviour??
I am still having the same problem. The code recognizes the image in the folder because it "writes" its link onto the webpage. HOWEVER, when clicking that link the image is replaced by the standard missing image icon???
I have already included my chunk of code as per the moderator's request, but have not heard back since???
Any help in resolving this would greatly be appreciated!
Thanks
|
|

July 9th, 2004, 11:03 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Nancy,
Have you checked that the offending images have security set so that that the internet guest account can see them?
HTH,
Chris
|
|

July 9th, 2004, 12:13 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm sorry I don't quite understand what you mean by: "have security set so that that the internet guest account can see them?"
Could you kindly explain?
Thanks Chris
|
|

July 9th, 2004, 01:25 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Nancy,
I assume because you are using the fso you are windows based.
If you can look at the image files in windows explorer, right click, select properties -> security. Check out which groups have access to the file & what kind of access.
You may find that access is restricted to admin / system or some other combination, in which case the fso may find them, but an internet guest will not be allowed to access them.
Best regards,
Chris
|
|
 |