Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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 February 21st, 2008, 05:05 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default Can we detect a broken image

Is it possible to detect a broken image?

The reason being - I render graphs like so:

<IMG SRC="barCausalGraph.asp ....> (using the third party csDrawGraph.dll component )

On the page I am currently employing this tactic:

1.on page A I run query to get a two dimentional array for my graph
2.check is not EOF
3.if not EOF, run the <IMG SRC="barCausalGraph.asp ...> code (which of course is on page B) and graph dispalys on page A fine

However if at step 2 it is EOF of course I display a message saying 'no data found...' therefore no graph is shown on page A

Is there a way to skip step 1 go strait to step 2 then detect is the Image is broken? If it is then display my 'no data found mssge'?

I want to do this becase there is no need to run the query on page A. It is run only to detect if I should go to step 2. As Im sure you are aware, the query on page A is a duplicate of the query run on page B. If I could detect if the image is broken (therefore no graph will be shown) I can make my page less resource hungry. The query is conditionaly very long as the end user uses a wizard to get the exact graph they want. There is 20 or 30 possible categories/conditions they may choose from.

Sorry for the long winded post. I attempted to make my process/ question as clear as possible.

TYIA



Wind is your friend
Matt
www.elitemarquees.com.au
__________________
Wind is your friend
Matt
 
Old February 21st, 2008, 05:11 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Hmm. I am unfamiliar with the component but couldn't you do something like this on page B:

if rs.eof
'Send a place holder image that says 'No Data Found'
else
'Send graph
end if

or is this not an option?

================================================== =========
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 February 21st, 2008, 05:18 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Hi Doug

Its from http://www.chestysoft.com/drawgraph/default.asp I have found it to be a great component. very worth $50. I have email them about changes EG including a liniar regretion type trend line. The guy updated and sent me a new dll within days. Good bloke.

I not sure how I would send a place holder given page B is called within the image tag. I have exclude the query however here is the code that draws the chart (also gives other users a snap shot of some of tyhe chart properties):

     do while not values.eof
        Chart.AddData values(0), values(1), colours(count)
        values.moveNext
        count = count + 1
     loop
     if runSecondConRS = true then
        if not seconConRS.Eof then
           do until seconConRS.Eof
              Chart.AddData seconConRS(0), seconConRS(1), colours(count)
              seconConRS.moveNext
              count = count + 1
           loop
        end if
     end if
     Chart.Width = request.queryString("width")
     Chart.Height = request.queryString("height")
     Chart.LegendX = request.queryString("width") -135
     Chart.MaxX = request.queryString("width")-180
     Chart.MaxY = request.queryString("height")-210
     Chart.LegendTextSize = 7
     Chart.BarWidth = 15
     Chart.GridColor = "#cccccc"
     Chart.XAxisText = session("xAxisName")
     Chart.YAxisText = "Number of Incidents"
        'Chart.Title = session("osirTypeName")
     Chart.LabelVertical = true
     Chart.ShowBarTotal = true
     Chart.AxisTextBold = true
     Chart.ShowGrid = true
     Chart.ShowTrendLine = trendLine
     Chart.TrendLineColor = request.queryString("trendColor")
     Chart.TrendLineWidth = 1
     Response.ContentType = "Image/Gif"
     Response.BinaryWrite Chart.GIFBar
     Response.End
     set chart=nothing
     set values=nothing
     if isobject(runSecondConRS) then set runSecondConRS = nothing end if
     conn.close
     set conn = nothing

Wind is your friend
Matt
www.elitemarquees.com.au
 
Old February 21st, 2008, 05:32 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Hi Matt,
Essentially you are going to do the same thing: create a stream and then write that stream (or byte array) to the response stream.

I have never served an image from the file system through a stream in classic, it was always in a database so I am not of much help there. The second code sample on this page should help you though: http://www.rodsdot.com/ee/dynamicImage.asp

If you want to stream from a database you can use a form of this code:
http://authors.aspalliance.com/steve...imagequery.asp

hth.

================================================== =========
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 February 21st, 2008, 05:48 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Cheers mate. As always I appriciate your time. I will have a good read through your links.

Wind is your friend
Matt
www.elitemarquees.com.au
 
Old February 21st, 2008, 07:14 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

No problem. I hope one of the links provide you with a solution. =]
-Doug

================================================== =========
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
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Detect image suffix? mat41 Javascript How-To 5 July 28th, 2005 06:43 PM
SignOut is broken? cohansh1 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 June 21st, 2005 01:09 AM
broken cd waz84792 Flash (all versions) 5 October 22nd, 2004 08:42 AM
Broken References tcarnahan Access VBA 4 December 19th, 2003 12:10 AM
Detect srcElement on Embedded Image TSEROOGY Javascript 8 August 29th, 2003 01:42 PM





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