 |
| Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Professional 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
|
|
|
|

January 24th, 2008, 05:10 PM
|
|
Registered User
|
|
Join Date: Jan 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ASP vbscript dynamic image display
Hi,
I am having a heck of a time trying to get an image to be displayed on a webpage using ASP and VBScript. I am trying to match images numbered in a folder with data from an Access DB that have the same numbering system. I am adding three zeros at the beginning of the number to match what is in the images folder.
Has anyone done this or can help. Below is just part of the code.
Response.Write ("<TABLE ALIGN=LEFT BORDER=""5"" CELLPADDING=""0"" CELLSPACING=""0"" TABLE WIDTH=""100%"" HEIGHT=""2"" BORDERCOLORLIGHT=""#DDDDDD"" BORDERCOLORDARK=""#DDDDDD"" FRAME=""BORDER"" HSPACE=""0"" VSPACE=""0"" BGCOLOR=""#GGGGGG"">")
Do While not rsGetRecords.EOF
Response.Write ("<tR>")
Response.Write ("<tD BGCOLOR=#FFFFFF ALIGN=""LEFT"">")
Response.Write ("<img src="images\Logos\thumbnails\logo_" & "000" & rsGetRecords("LogoNumber") & ".jpg">")
Response.Write ("</tD>")
Response.Write ("</tR>")
Loop
|
|

January 24th, 2008, 05:13 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
And what exactly is the problem? Does the code not compile, or do the images not show up? Can you elaborate?
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
|
|

January 24th, 2008, 05:22 PM
|
|
Registered User
|
|
Join Date: Jan 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It is not compiling. I just get the default IE error: HTTP 500 Internal Error.
I should have mentioned that I am only using notepad to code this.
|
|

January 24th, 2008, 05:37 PM
|
|
Registered User
|
|
Join Date: Jan 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Oh, I forgot to include the movenext in the post, but it is in the original code.
The page immeditaly goes to the error.
I was getting a syntax error and it was point to my img src line. I think this is the issue.
Response.Write ("<img src="images\Logos\thumbnails\logo_" & "000" & rsGetRecords("LogoNumber") & ".jpg">")
Can we not add pieces with the & " " & ? I was certain this is how it can be done.
|
|

January 24th, 2008, 05:41 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
quote:I was getting a syntax error
|
In that case, it would help if you posted the actual error message. Look at this:
Response.Write ("<img src= "images\Logos\thumbnails\logo_" & "000" & rsGetRecords("LogoNumber") & ".jpg">")
You try to output a quote for the src attribute. However, you are already inside a string so you need escape it by doubling the quote:
Response.Write ("<img src= ""images\Logos\thumbnails\logo_" & "000" & rsGetRecords("LogoNumber") & ".jpg "">")
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
|
|

January 24th, 2008, 05:43 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
This: Response.Write ("<img src="images\Logos\thumbnails\logo_" & "000" & rsGetRecords("LogoNumber") & ".jpg">")
Should be
Response.Write("<img src="images\Logos\thumbnails\logo_" & "000" & rsGetRecords("LogoNumber") & ".jpg"">")
Try that.
Ahh Imar beat me to it.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
|
|

January 24th, 2008, 05:57 PM
|
|
Registered User
|
|
Join Date: Jan 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
That worked.
You both are brilliant. Thank you so much for solving this.
|
|

January 24th, 2008, 07:53 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Glad it worked out for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
|
|

January 31st, 2008, 11:42 AM
|
|
Registered User
|
|
Join Date: Jan 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How about this modification to the above.
This time I am trying to get the description of the image to display then when you hover/mouse over the image will display.
Logically, I would think below would have worked, but it isn't.
Response.Write ("<a href=""#""> & rsGetRecords("StaticImageTimedDescription") & <img src=""Image_Web_Gallery\Image_" & "000" & rsGetRecords("StaticImageTimedNumber") & ".jpg"" class=""preview""/></a>")
It works if done like this, but I need to dynamically get the image name:
Response.Write ("<a href=""#""> Image Preview <img src=""Static_Image_Web_Gallery\Image_" & "0" & rsGetRecords("StaticImageTimedNumber") & ".jpg"" class=""preview"" /></a>")
|
|
 |