RTC Forums
November 24, 2024, 11:38:54 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: response must include a small image ?  (Read 7252 times)
karen
Guest
« on: February 19, 2010, 01:17:57 PM »

Hello

How does one include an image in the html when responding to a multipart POST ?

This does not work: Write( '<img border="0" src="crop.jpg" alt="the small image" />' );

For instance extending the client upload example to include a small image.

Thanks
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: February 19, 2010, 01:29:07 PM »

You do NOT *include* an image in HTML. By using the <img> HTML tag, you provide an URL to the Browser (client) where the image can be downloaded. The Browser then uses that info ('crop.jpg' in your example) to send another request to the Server and download the image. And the same way you have provided the HTML to the Client, you can provide the image. In other words, send the image file out like any other file, when the Client asks for it.

If you need an example on how to send files to the Client, take a look at the FileServer demo in the Projects folder.

Best Regards,
Danijel Tkalcec
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #2 on: February 19, 2010, 01:39:40 PM »

Also ... when sending HTML data out to a Browser, make sure it is embedded inside all proper HTML tags.

For example, like this:
  Write('<html><body>');
    Write('Here is my HTML page text');
    Write('<img border="0" src="crop.jpg" alt="the small image" />');
  Write('</body></html>');

It is also a good idea to set Response.ContentType to the correct (media) type before writing any data out. That would be 'text/html' when sending HTML, 'image/jpeg' when sending a JPEG file, and so on. You can check the RTCWebServer example for a more complete list of some standard media types.

Best Regards,
Danijel Tkalcec
Logged
karen
Guest
« Reply #3 on: February 21, 2010, 04:24:22 PM »

Ok, thanks. I understand. I have added a dataprovider to my server app to serve the small image files and it works great. You can see it in action in a very simple online demo. User can submit an image to one of our automatic number plate recognition engines ANPR. We return the number plate characters and a small crop out of the image. Our users are fairly technical and this is specialized - not for public. So please don't judge our website and presentation - we know - they are horrible!  Wink  www.anpr.co.za
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #4 on: February 21, 2010, 06:00:13 PM »

Thank you for your feedback. It is exciting to see how the RealThinClient SDK is used in real live projects. I wish more developers would be posting about their projects.

PS. Too bad I do not have a photo of a South African license plate Wink I've uploaded a poor quality JPG of a local license plate, but your system did not like it and told me to <quote> Please send an image containing a valid number plate. </quote> Cheesy

Best Regards,
Danijel Tkalcec
Logged
karen
Guest
« Reply #5 on: February 21, 2010, 07:42:41 PM »

 Smiley Added sample image using same rtc "image" file server technique. Now project dynamically creates submit form including sample. User can input own image or use sample. Image sent based on method in rtcBrowerUpload project. Project incorporates more than one rtc server, it uses rtc for a few other things as well as customised client based on rtcClientUpload project. Project changes so often that we need server near us so we run it on box in home-office only on DSL connection - not at ISP so IP address changes unexpectedly. Must take care of that automatically for demo to be online. Therefore made a file, $time and $IP server (based on rtcFileServer project) for another server running at ISP where IP add is fixed. (our own DnyDns) The ANPR server auto-checks for IP changes then dynamically builds and writes corrected html file to website. When user clicks "try demo" that file is used and makes sure transparently redirected to correct place.

What I mean to say is we could not do all this without RTC - Thanks
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #6 on: February 22, 2010, 01:03:39 AM »

Perfect! Smiley

I've downloaded your image, cropped it so the license plate was on a different position and the image was smaller, uploaded it and -voila! got this response: <quote> NP61284 - (here was the plate image) the plate </quote>.

Well, that was easy Tongue

But then, to check that you are really reading the image and not just sending out a pre-formatted webpage, I've rotated the image 180 degrees (upside down) and ... got this response: <quote> 98ÖT9JN - (here was my upside-down image) </quote> ... which generates a bit of a different result, but it also proves that you are actually processing the image Wink

Excellent example. Thank you for posting a link to your test Server.

Best Regards,
Danijel Tkalcec
Logged
karen
Guest
« Reply #7 on: February 22, 2010, 03:39:39 AM »

You can try images of vehicles from many other countries. Most work if font/size similar to sample. We had plates from all over including Hungary, Romania, Cyprus, England. Works with most of Europe. It is possible to set engine for any country, even Cyrillic, Arabic or Chinese etc. Normally images we process are optimized starting with TCP/IP cameras carefully setup in fixed position and engine tuned to environment. Online demo cannot know what type of image we may have to process. Therefore demo uses 6 x threaded anpr engines each tuned slightly differently in the hope that we will get almost any plate uploaded via browser.

When I get time I try to improve appearance by using html template and css which I will learn from rtcParse2 and 3 projects.

Thanks again.  Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.027 seconds with 17 queries.