Image from a WebService

Discussion in 'ASP .Net' started by Nicolas, Jun 20, 2006.

  1. Nicolas

    Nicolas Guest

    Hello!

    I have a question: I have a database in MySql that has two fields (code and
    image). Now, I want to create a WebService that takes the image of the most
    current row (the code is the date in which the image took). And then, create
    a page in ASP.NET that calls this WebService, show the image and repeat this
    behavior every 5 seconds (it is the time that is take a new image be
    creating in the base of information). Can someone help or at least orientate
    me in this?

    Thank you very much and sorry about my poor english :)
     
    Nicolas, Jun 20, 2006
    #1
    1. Advertising

  2. Nicolas,
    ASP.NET WebServices transmit images as type byte[] (a byte array) and they
    are typically sent over the wire as Base64 Encoded string of data.

    Your consumer application should be able to take this byte[] stream result
    of it's WebMethod call and, using one of the Image Class overloads, load it
    into an Image object for display.

    Peter
    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "Nicolas" wrote:

    > Hello!
    >
    > I have a question: I have a database in MySql that has two fields (code and
    > image). Now, I want to create a WebService that takes the image of the most
    > current row (the code is the date in which the image took). And then, create
    > a page in ASP.NET that calls this WebService, show the image and repeat this
    > behavior every 5 seconds (it is the time that is take a new image be
    > creating in the base of information). Can someone help or at least orientate
    > me in this?
    >
    > Thank you very much and sorry about my poor english :)
    >
    >
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Jun 20, 2006
    #2
    1. Advertising

  3. Hi,

    Peter Bromberg [C# MVP] wrote:
    > Nicolas,
    > ASP.NET WebServices transmit images as type byte[] (a byte array) and they
    > are typically sent over the wire as Base64 Encoded string of data.
    >
    > Your consumer application should be able to take this byte[] stream result
    > of it's WebMethod call and, using one of the Image Class overloads, load it
    > into an Image object for display.
    >
    > Peter


    For a web application, an elegant alternative could be to use the
    ability that the Image objects have to reload themselves without the
    whole page having to be refreshed.

    For example:

    var nImg = document.getElementById( "myImage" );
    if ( nImg
    && nImg.src )
    {
    nImg.src = "image.gif";
    }

    and to set a timer to call this code every 5 seconds.

    HTH,
    Laurent
    --
    Laurent Bugnion, GalaSoft
    Software engineering: http://www.galasoft-LB.ch
    Private/Malaysia: http://mypage.bluewin.ch/lbugnion
    Support children in Calcutta: http://www.calcutta-espoir.ch
     
    Laurent Bugnion, Jun 21, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. batista
    Replies:
    1
    Views:
    965
    Laurent Bugnion
    Jan 26, 2006
  2. batista
    Replies:
    0
    Views:
    585
    batista
    Jan 26, 2006
  3. Mr. x
    Replies:
    2
    Views:
    742
    Andrew
    Oct 10, 2003
  4. Cyril
    Replies:
    2
    Views:
    4,560
    Cyril
    Jun 1, 2006
  5. Mr. x

    use another webservice in a webservice

    Mr. x, Sep 26, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    158
    Mr. x
    Sep 26, 2003
Loading...

Share This Page