Results 1 to 5 of 5

Thread: Reading Binary Image from Database

  1. #1
    Join Date
    Jul 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Reading Binary Image from Database

    Hi, i have an sql database the store the images as a binary data, and i am using some code in asp to view the images in html in img tag, and i tried to change the code of images Slideshow to read from the database but its not working for me

    could you please help me, its urgent

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    We would need to see the asp code for the img tag and the javascript code for the slide show. Please post the asp code and link to the javascript code.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    ok this is my code
    for the page that contain the slideshow
    ----------------------------------------------
    Code:
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript" src="fadeslideshow.js">
    </script>
    <script type="text/javascript">
    var mygallery=new fadeSlideShow({
    wrapperid: "fadeshow1", 
    dimensions: [250, 180], 
    <%
    //connect to the database
    rs.open "select * from mcontents where ctype = 'image'",cn		
    %>
    
    imagearray: [
    ["<img src=../../ShowDataFile.asp?rid=<%=rs('rid')%>&ftype=file2 />", "", "", "<%=rs('title')%>"] 
    ],
    displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
    persist: false, 
    fadeduration: 500, 
    descreveal: "peekaboo",
    togglerid: ""
    
    })
    
    </script>
    </head>
    
    <body>
    <div id="fadeshow1"></div>
    </body>
    ------------------------------------------

    and for the ShowDataFile.asp the view the Binary image contain the following
    -------------------------------------------
    Code:
    if filetype = "file2" then
    Response.ContentType = Rs("ContentType2")
    Response.BinaryWrite Rs("BinaryData2")
    -------------------------------------------


    I know that i am writting something wrong
    but i dont know how to fixe it please help me
    Last edited by jscheuer1; 07-07-2010 at 01:52 PM. Reason: format code

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm not real up on asp, though I'm not exactly a beginner either. I asked to see an img tag because that would give me a better idea of what's going on. You didn't do that, but this:

    Code:
    <img src=../../ShowDataFile.asp?rid=<%=rs('rid')%>&ftype=file2 />
    Looks like it might be what I need.

    Now, in the end we want the page's served code to be what it would be if we had hard coded everything according to the instructions from the demo page for this script. This is easily seen by using the browser's 'view source' when viewing the page.

    Here:

    Code:
    imagearray: [
    ["<img src=../../ShowDataFile.asp?rid=<%=rs('rid')%>&ftype=file2 />", "", "", "<%=rs('title')%>"] 
    ],
    We want to see something like so:

    Code:
    imagearray: [
    ["somepath/someimage.jpg", "", "", "some description"] 
    ],
    But we are going to need more than just one of the highlighted line, and all lines like that should point to different images and all but the last one needs a comma at the end. Asp has a way of doing things in a loop while something is true - say, while a counter that gets incremented each pass of the loop is under a certain amount. So you are going to have to do something like that to make more than one. And figure out a way to end up without a comma at the end of the last one (having a comma at the end of the last one is only a problem in some IE browsers in some modes, or all IE browsers in other modes).

    Before you figure that out you need to make the output of each of these lines match the template of the highlighted line so as to fit the requirements of the script. That would probably be like so:

    Code:
    ["../../ShowDataFile.asp?rid=<%=rs('rid')%>&ftype=file2", "", "", "<%=rs('title')%>"],
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. The Following User Says Thank You to jscheuer1 For This Useful Post:

    noora (07-12-2010)

  6. #5
    Join Date
    Jul 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Its working now
    Thank you very much

Bookmarks

Posting Permissions

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