Results 1 to 16 of 16

Thread: pass image from byte array control.

  1. #1

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    pass image from byte array control.

    Is there a control that you can use?
    It can be done by fetching a binaryread from an aspx page but why there isn't a simple free image control that you can put in the page and feed it a byte array?
    I've searched for hours.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  2. #2
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: pass image from byte array control.

    I hope this should be helpfull to you.
    __________________
    Rate the posts that helped you

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: pass image from byte array control.

    Interesting, I didn't actually know there was a specific ImageHandler, I have always just used a generic ASP.Net handler.

    Thanks for pointing that out!!

    Sap, did this work for you?

    Gary

  4. #4

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: pass image from byte array control.

    Guys i'm an a harry i just got in to say that i will try everything one every post and let you know.But i have 2-3 appointments today so i must be off.
    will let you know.
    Thanks.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  5. #5

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: pass image from byte array control.

    Well i actually see that you need again 2 pages like you do on ashx.
    Anyway i'm giving this a try but no it's not exactly what i need.Again i think asp does not support something like a simple byte image read on one page.
    ......
    Edit: I have stoped trying btw it's not what i want.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: pass image from byte array control.

    Why exactly isn't it what you want?

    Granted, the ASHX, or ImageHandler is a separate object, but you can include it on your page?!?

    Gary

  7. #7

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: pass image from byte array control.

    I can include it on my page?
    Well imageHandler will get the data on my page but i have to bind it in some control.
    I'm using this now (again) but what i really would like is to have a byte() array and in an object on my page i could instantly render it as an image.
    That would be nice.
    I think the image in winforms can render data through a bitmap.Here i don't see something similar. :/
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  8. #8
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: pass image from byte array control.

    Quote Originally Posted by sapator View Post
    I can include it on my page?
    By that I meant you would do something like this:

    Code:
    <img src="Handler.ashx?PhotoID=<%# Eval("ID") %>&Size=L" class="photo_198" style="border:4px solid white" alt='Photo Number <%# Eval("ID") %>' />
    Where Handler.ashx is the ASP.Net Handler that I created, and I am calling that using QueryString parameters indicating which Image I want returned.

    Quote Originally Posted by sapator View Post
    Well imageHandler will get the data on my page but i have to bind it in some control.
    I'm using this now (again) but what i really would like is to have a byte() array and in an object on my page i could instantly render it as an image.
    That would be nice.
    I think the image in winforms can render data through a bitmap.Here i don't see something similar. :/
    So this is what the above does. The Handler generates the bytes, and writes it out in the response stream for the request, and the image appears exactly where the image tag is.

    Gary

  9. #9

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: pass image from byte array control.

    Well.That's what i am using but it's for the modal popup on the calendar and i wanted to have a stable data storage on the page so i don't have to hit the server every time i go to the next line of a listbox to get a new picture.
    Anyway i've incorporated it now so that is that....
    Correction i use the image inside a formview but that's about the same.
    Gary, something i see is that this will sometimes goes a little "slow" in order to fetch the picture from sql.I'm assuming since that this has to do with the fact that the data must be "scanned" from the ashx page byte by byte, so, and correct me if i'm wrong,it does not have to do something with the performance of SQL.I mean the speed will be what it is for one user fetching and image or 100 users fetching and image(assuming the the SQL can handle 100 users at once with ease) .It just slows on the async transaction.
    Am i correct?
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  10. #10
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: pass image from byte array control.

    Quote Originally Posted by sapator View Post
    Well.That's what i am using but it's for the modal popup on the calendar and i wanted to have a stable data storage on the page so i don't have to hit the server every time i go to the next line of a listbox to get a new picture.
    Anyway i've incorporated it now so that is that....
    Correction i use the image inside a formview but that's about the same.
    Gary, something i see is that this will sometimes goes a little "slow" in order to fetch the picture from sql.I'm assuming since that this has to do with the fact that the data must be "scanned" from the ashx page byte by byte, so, and correct me if i'm wrong,it does not have to do something with the performance of SQL.I mean the speed will be what it is for one user fetching and image or 100 users fetching and image(assuming the the SQL can handle 100 users at once with ease) .It just slows on the async transaction.
    Am i correct?
    You are correct in that ASP.Net will need to go and get the byte information from the database, and then display it to the user, and this will need to happen on each request, so there will be some lag time in that happening.

    However, this is where caching comes into play. Cache the image, so that ASP.Net doesn't have to go off to the database each time, but rather just gets it from the Cache. At the end of the day, the image is fairly static information, once you have it, it isn't going to change.

    Gary

  11. #11

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: pass image from byte array control.

    Hi.
    2 questions.
    1)The caching could be 100 clients going through 100 images(well rough scenario but i will like to think the worst).
    So 10000 images may have to be cached.Is this advisable?

    2)How do i do this?I just add a reference to web.config, or i must try reading this stuff http://www.codeproject.com/KB/aspnet...sInASPNET.aspx () ? Remember the images are coming from sql server as byte, they won't be in a folder so they can be stable..
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  12. #12
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: pass image from byte array control.

    1) If they are the same images, then it wouldn't be 10000 images, it would be 100 images, cached for each user to look at when they wanted. ASP.Net does quite a good job of maintaining the cache, and you can set a length of time that an item will remain in the cache, before any subsequent request has to go back to the database.

    2) Did you look at the Beer House Sample kit that I think I mentioned earlier? Take a look at the DAL for the Forum module, it shows exactly how you can do it.

    Gary

  13. #13

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: pass image from byte array control.

    Unfortunately it's not 100 images, it's 10000.They are not the same.
    So is it still a go?The server is a good one if i remember correctly.HP with 24GB memory but they will host 5-10 sites, exchange,active dir etc...
    Fair enough, i'll take a look at the sample.
    Just putting it here for reference...
    http://thebeerhouse.codeplex.com/releases/view/127
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  14. #14
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: pass image from byte array control.

    I think you should still be ok. Assuming you set up caching correctly, and don't keep the images in the cache indefinitely.

    I have spent quite a bit of time looking at the Beer House code, so if you have any questions, feel free to pass them my way.

    Gary

  15. #15

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: pass image from byte array control.

    Alright, i'll do that.
    I'll be having 2 days off and then probably another 5 days in a Greek island and tonight we had a black out
    So i haven't look at anything but i'll be here if not from Monday a week or so later.I still owe you the calendar control look from the site btw
    It's ready to go but i'll have to go to the company and create an account and some data for you and also start the paypal pages(remote is currently f#cked up).
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  16. #16
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: pass image from byte array control.

    Sounds like a plan!!

    Yip, looking forward to seeing the calendar control.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width