Login  
Search All Forums
Dart Home | PowerTCP WebServer for ActiveX | Custom Development Reply | PowerTCP WebServer for ActiveX Topics | Forums   
AuthorForum: PowerTCP WebServer for ActiveX
Topic: Adding img scr link to the web page
subhendu

From: Kolkata, India
Posts: 8
Member Since: 05/20/03
posted May 20, 2003 8:08 AM

Hello,

I am trying to send a html web page to the client browser, using WebServer Tool.

I have set the root directory to app.path.
And the image directory (containing the referenced images) is placed under app.path.

The code to reference the images is as follows-

<img height='1' src='/image/spacer.gif' width='1' border='0'>

I am not able to get the images in the generated html page.

Can you help me??

Thanks.
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted May 20, 2003 5:17 PM

Hi,
The source should not begin with "/".
It should work if the path is changed to:
src='image/spacer.gif'

Hope it helps,
-ken
subhendu

From: Kolkata, India
Posts: 8
Member Since: 05/20/03
posted May 24, 2003 5:22 AM

Hi,

Thanks for your reply. But, I am still facing the same problem.

The following is the entire code that I have used,

Option Explicit

Private Sub Command1_Click()
  With Me.WebServer1
    .RootDirectory = "C:\WINDOWS\Desktop\Sample"
    .LogDirectory = "C:\WINDOWS\Desktop\Sample"
    .Start 80, -1, "172.16.2.25", "172.16.2.25", 0, 0
  End With
End Sub

Private Sub Command2_Click()
  Me.WebServer1.Stop
End Sub

Private Sub WebServer1_Get(ByVal Session As DartWebServerCtl.ISession, ByVal Request As DartWebServerCtl.IRequest, ByVal Response As DartWebServerCtl.IResponse)
  Call SendPage(Response)
End Sub

Private Function GetHostName() As String
  GetHostName = "http://" + Me.WebServer1.LocalAddress
  If (Me.WebServer1.LocalPort <> 80) Then GetHostName = GetHostName + ":" + Me.WebServer1.LocalAddress
End Function

Private Sub SendPage(ByVal Response As DartWebServerCtl.IResponse)
  'NOTE:
  'Image path is "C:\WINDOWS\Desktop\Sample\images"
  'Content of the images folder is "borland.gif"
  
  Dim sText As String
  sText = ""
  sText = sText + "<html>"
  sText = sText + "<head>"
  sText = sText + "<title>Sample</title>"
  sText = sText + "</head>"
  sText = sText + "<body>"
  sText = sText + "<img src=""" + GetHostName + "/images/borland.gif"">"
  sText = sText + "</body>"
  sText = sText + "</html>"

  Dim Body As New DartStream
  Body.Write sText
  Response.Status = httpOK
  Response.Body = Body
End Sub

subhendu

From: Kolkata, India
Posts: 8
Member Since: 05/20/03
posted May 26, 2003 3:07 AM

Hi,

Have I been able to clear by question to you?

Subhendu.
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted May 27, 2003 4:58 PM

Hi,
Try using the Trace method to examine the communication between the server and the browser. It should provide clues as to what is happening when the browser tries to get the images (or even if it is).

Thanks,
-ken
chris@digitalinsights.com

From: San Clemente, CA USA
Posts: 73
Member Since: 11/03/03
posted November 3, 2003 7:37 PM

Did you ever find out what the problem was to your issue? I have the same problem with the Chinese language breaking the images from being sent to the browser.
gavintaylor

From: boise, ID USA
Posts: 1
Member Since: 11/26/03
posted November 26, 2003 1:39 PM

When the client request the .gif file you are sending the whole dynamic page again. You need to verify in the get method whether the client is requesting the .gif file or the .htm file.

if file extention = .htm then
  SendPage()
else
  do nothing
endif
Reply | PowerTCP WebServer for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX