Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
 
Old January 24th, 2008, 05:10 PM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old January 24th, 2008, 05:13 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old January 24th, 2008, 05:22 PM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
 
Old January 24th, 2008, 05:25 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Does the page seem really slow? You forgot a MoveNext:

Do While not rsGetRecords.EOF
  ...
  Response.Write ("</tR>")
  rsGetRecords.MoveNext()
Loop

To get detailed error info, take a look here: http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=264

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.
 
Old January 24th, 2008, 05:37 PM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old January 24th, 2008, 05:41 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old January 24th, 2008, 05:43 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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
================================================== =========
 
Old January 24th, 2008, 05:57 PM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That worked.
You both are brilliant. Thank you so much for solving this.

 
Old January 24th, 2008, 07:53 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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
================================================== =========
 
Old January 31st, 2008, 11:42 AM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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>")





Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload image-create & save thumbnail-display image angshujit ASP.NET 2.0 Professional 6 July 11th, 2013 10:34 PM
VBScript Error on Image upload - help! ngupta Classic ASP Components 10 October 24th, 2006 07:33 PM
dynamic image display in CR in asp.net mpkrishna Crystal Reports 0 March 29th, 2005 01:44 AM
How to Display the image from the image field. mikeparams SQL Server 2000 1 October 29th, 2004 02:23 AM





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