How to display an image\picture column via BDC Web Part?Hello,<br>I have an SQL Server with a table that has an image column (that contains a binary array) and I want to display it with a BDC selection.<br>Am I asking too much, I know that images require a server source location, but I was hoping it could be displayed as a resource (like js files that appear as resources links in the dll files).<br><br>Thank you.<br> © 2009 Microsoft Corporation. All rights reserved.Sun, 05 Apr 2009 16:04:11 Zd2b18c36-c5b4-43d3-bae2-d9fd2b491a29http://social.msdn.microsoft.com/Forums/en-US/sharepointbdc/thread/d2b18c36-c5b4-43d3-bae2-d9fd2b491a29#d2b18c36-c5b4-43d3-bae2-d9fd2b491a29http://social.msdn.microsoft.com/Forums/en-US/sharepointbdc/thread/d2b18c36-c5b4-43d3-bae2-d9fd2b491a29#d2b18c36-c5b4-43d3-bae2-d9fd2b491a29Shemesh Morhttp://social.msdn.microsoft.com/Profile/en-US/?user=Shemesh%20MorHow to display an image\picture column via BDC Web Part?Hello,<br>I have an SQL Server with a table that has an image column (that contains a binary array) and I want to display it with a BDC selection.<br>Am I asking too much, I know that images require a server source location, but I was hoping it could be displayed as a resource (like js files that appear as resources links in the dll files).<br><br>Thank you.<br> Thu, 04 Sep 2008 14:32:14 Z2008-09-04T14:32:14Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointbdc/thread/d2b18c36-c5b4-43d3-bae2-d9fd2b491a29#d75d1934-855b-4f4f-ba25-757bcc4732e0http://social.msdn.microsoft.com/Forums/en-US/sharepointbdc/thread/d2b18c36-c5b4-43d3-bae2-d9fd2b491a29#d75d1934-855b-4f4f-ba25-757bcc4732e0Ben Cline1http://social.msdn.microsoft.com/Profile/en-US/?user=Ben%20Cline1How to display an image\picture column via BDC Web Part?I was able to accomplish this by editing the XSL in the BDC web part. Open up the BDC web part properties and then click the button for XSL. I was storing the full path to the image and basically changed the default XSL to output in an img tag. Here is the XSL before editing it:<br/><br/> <div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" border=0 cellspacing=0 cellpadding=0> <colgroup> <col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap"> </colgroup> <tbody> <tr> <td><span>&lt;</span><span style="font-size:11px">td </span><span>class</span><span style="font-size:11px">=</span><span>&quot;ms-vb&quot;</span><span style="font-size:11px">&gt;  </span></td> </tr> <tr> <td style="background-color:#f7f7f7">        <span>&lt;</span><span style="font-size:11px">xsl:attribute </span><span>name</span><span style="font-size:11px">=</span><span>&quot;style&quot;</span><span style="font-size:11px">&gt;  </span></td> </tr> <tr> <td>          <span>&lt;</span><span style="font-size:11px">xsl:choose</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td style="background-color:#f7f7f7">            <span>&lt;</span><span style="font-size:11px">xsl:when </span><span>test</span><span style="font-size:11px">=</span><span>&quot;$dvt_1_form_selectkey = @*[name()=$ColumnKey]&quot;</span><span style="font-size:11px">&gt;color:blue</span><span>&lt;/</span><span style="font-size:11px">xsl:when</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td>            <span>&lt;</span><span style="font-size:11px">xsl:otherwise </span><span>/&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td style="background-color:#f7f7f7">          <span>&lt;/</span><span style="font-size:11px">xsl:choose</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td>        <span>&lt;/</span><span style="font-size:11px">xsl:attribute</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td style="background-color:#f7f7f7">        <span>&lt;</span><span style="font-size:11px">xsl:variable </span><span>name</span><span style="font-size:11px">=</span><span>&quot;fieldValue&quot;</span><span style="font-size:11px">&gt;  </span></td> </tr> <tr> <td>          <span>&lt;</span><span style="font-size:11px">xsl:call-template </span><span>name</span><span style="font-size:11px">=</span><span>&quot;LFtoBR&quot;</span><span style="font-size:11px">&gt;  </span></td> </tr> <tr> <td style="background-color:#f7f7f7">            <span>&lt;</span><span style="font-size:11px">xsl:with-param </span><span>name</span><span style="font-size:11px">=</span><span>&quot;input&quot;</span><span style="font-size:11px">&gt;  </span></td> </tr> <tr> <td>              <span>&lt;</span><span style="font-size:11px">xsl:value-of </span><span>select</span><span style="font-size:11px">=</span><span>&quot;@Picture&quot;</span><span style="font-size:11px"> </span><span>/&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td style="background-color:#f7f7f7">            <span>&lt;/</span><span style="font-size:11px">xsl:with-param</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td>          <span>&lt;/</span><span style="font-size:11px">xsl:call-template</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td style="background-color:#f7f7f7">        <span>&lt;/</span><span style="font-size:11px">xsl:variable</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td>        <span>&lt;</span><span style="font-size:11px">xsl:copy-of </span><span>select</span><span style="font-size:11px">=</span><span>&quot;$fieldValue&quot;</span><span style="font-size:11px"> </span><span>/&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td style="background-color:#f7f7f7"><span>&lt;/</span><span style="font-size:11px">td</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> </tbody> </table> </div> <br/><br/>And here is the XSL after I edited it (to show you how I accomplished this):<br/><br/> <div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" border=0 cellspacing=0 cellpadding=0> <colgroup> <col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap"> </colgroup> <tbody> <tr> <td><span>&lt;</span><span style="font-size:11px">td </span><span>class</span><span style="font-size:11px">=</span><span>&quot;ms-vb&quot;</span><span style="font-size:11px">&gt;  </span></td> </tr> <tr> <td style="background-color:#f7f7f7">        <span>&lt;</span><span style="font-size:11px">xsl:attribute </span><span>name</span><span style="font-size:11px">=</span><span>&quot;style&quot;</span><span style="font-size:11px">&gt;  </span></td> </tr> <tr> <td>          <span>&lt;</span><span style="font-size:11px">xsl:choose</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td style="background-color:#f7f7f7">            <span>&lt;</span><span style="font-size:11px">xsl:when </span><span>test</span><span style="font-size:11px">=</span><span>&quot;$dvt_1_form_selectkey = @*[name()=$ColumnKey]&quot;</span><span style="font-size:11px">&gt;color:blue</span><span>&lt;/</span><span style="font-size:11px">xsl:when</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td>            <span>&lt;</span><span style="font-size:11px">xsl:otherwise </span><span>/&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td style="background-color:#f7f7f7">          <span>&lt;/</span><span style="font-size:11px">xsl:choose</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td>        <span>&lt;/</span><span style="font-size:11px">xsl:attribute</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td style="background-color:#f7f7f7">          </td> </tr> <tr> <td>         <span>&lt;</span><span style="font-size:11px">xsl:element </span><span>name</span><span style="font-size:11px">=</span><span>&quot;img&quot;</span><span style="font-size:11px">&gt;  </span></td> </tr> <tr> <td style="background-color:#f7f7f7"><span>            &lt;</span><span style="font-size:11px">xsl:attribute </span><span>name</span><span style="font-size:11px">=</span><span>&quot;src&quot;</span><span style="font-size:11px">&gt;</span><span>&lt;</span><span style="font-size:11px">xsl:value-of </span><span>select</span><span style="font-size:11px">=</span><span>&quot;@Picture&quot;</span><span style="font-size:11px"> </span><span>/&gt;</span><span style="font-size:11px">&lt;/</span><span style="font-weight:bold">xsl</span><span style="font-size:11px">:attribute</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td><span>        &lt;/</span><span style="font-size:11px">xsl:element</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td style="background-color:#f7f7f7"><span>&lt;/</span><span style="font-size:11px">td</span><span>&gt;</span><span style="font-size:11px"> </span></td> </tr> <tr> <td> </td> </tr> </tbody> </table> </div> <br/><br/>I am not sure if you will be able to have the byte array output on the fly so I would suggest refering to the image like this or use some other ASPX page to pull the image from the database and output it in the response. <br/><br/>Thanks, <hr size=1> <br/>Fri, 05 Sep 2008 19:42:51 Z2009-04-03T03:49:00Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointbdc/thread/d2b18c36-c5b4-43d3-bae2-d9fd2b491a29#26f8f256-d41b-47eb-b3e6-a1bfae6f7d7chttp://social.msdn.microsoft.com/Forums/en-US/sharepointbdc/thread/d2b18c36-c5b4-43d3-bae2-d9fd2b491a29#26f8f256-d41b-47eb-b3e6-a1bfae6f7d7cAnonymousTodayhttp://social.msdn.microsoft.com/Profile/en-US/?user=AnonymousTodayHow to display an image\picture column via BDC Web Part?I don't know if this is the best way to do it, but this will produce an image from a file on the file system. Easily adapted to meet your requirements for pulling in from database.<br/><br/>Create this file in a subdirectory of TEMPLATE\LAYOUTS<br/><br/>Maybe DBIMAGES or something, in this example I called it Test.<br/><br/>Inside that create a .ashx file.<br/><br/>Name it whatever you like, I'll call it Test.ashx. Found the root of this concept at <span style="font-size:x-small"><a href="http://msdn.microsoft.com/en-us/library/bb457204.aspx">http://msdn.microsoft.com/en-us/library/bb457204.aspx</a></span><span style="font-size:x-small">  <pre lang=x-ashx>&lt;%@ Assembly Name=&quot;Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&quot; %&gt; &lt;%@ WebHandler Language=&quot;C#&quot; Class=&quot;HelloHttpHandler&quot; %&gt; using System; using System.Web; using Microsoft.SharePoint; public class HelloHttpHandler : IHttpHandler { public bool IsReusable { get { return false; } } public void ProcessRequest(HttpContext context) { SPWeb myWeb = SPContext.Current.Web; context.Response.ContentType = &quot;jpg&quot;; System.IO.FileStream fs = new System.IO.FileStream(&quot;c:/temp/bookOfPossibilities.jpg&quot;, System.IO.FileMode.Open); System.IO.BinaryReader br = new System.IO.BinaryReader(fs); context.Response.BinaryWrite(br.ReadBytes(Convert.ToInt32(br.BaseStream.Length))); fs.Close(); br.Close(); } }</pre> <font size=2> <p> </p> </font></span> <p><span style="font-size:x-small"><br/>For your bdc xsl find the rowview section and add this someplace:<br/><br/><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"> <pre lang=x-xml>&lt;img style=&quot;width:75px; height: 75px;&quot;&gt; &lt;xsl:attribute name=&quot;src&quot;&gt; http://{URLTOSITE}/_layouts/test/test.ashx?Position=&lt;xsl:value-of select=&quot;position()&quot;/&gt; &lt;/xsl:attribute&gt; &lt;xsl:attribute name=&quot;alt&quot;&gt; &lt;xsl:value-of select=&quot;position()&quot;/&gt; &lt;/xsl:attribute&gt; &lt;/img&gt;</pre> <font size=2 color="#0000ff"><font size=2 color="#0000ff"> <p> </p> </font></font></span><font size=2 color="#0000ff"> <p> </p> </font></span> <p><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">Oh, I just noticed, at the end of the URL I used, I put in position(), that's not needed, I was wanting to see what happens if I wanted to put some sort of parameter in the string to see if and how it would be passed. You can remove it.<br/><br/>Another way to do it is to going through this:<br/><a href="http://www.developer.com/net/article.php/10916_3812301_2">http://www.developer.com/net/article.php/10916_3812301_2</a><br/><br/>I did find another web article, bit I can't seem to find it.<br/><br/>Hope this helps.<br/><br/></span></span></p> </span></p>Thu, 02 Apr 2009 14:58:24 Z2009-04-02T14:58:24Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointbdc/thread/d2b18c36-c5b4-43d3-bae2-d9fd2b491a29#ef15a6f5-d972-4585-9139-d342a0001426http://social.msdn.microsoft.com/Forums/en-US/sharepointbdc/thread/d2b18c36-c5b4-43d3-bae2-d9fd2b491a29#ef15a6f5-d972-4585-9139-d342a0001426AnonymousTodayhttp://social.msdn.microsoft.com/Profile/en-US/?user=AnonymousTodayHow to display an image\picture column via BDC Web Part?Shemesh,<br/> <br/> I ran in to a problem that I was unaware of, and for the life of me don't understand why it does it.<br/> <br/> Firefox and Google's Chrome have a problem with doing it this way. For some reason they don't produce an image, and if alt is added to the image the alt tag is displayed, not like a broken image but just like normal text as part of the page. I'll be posting the problem on this board and maybe somebody will have an idea as to why.<br/> <br/> Could you verify this behavior and let me know if it does the same thing for you? <br/>Sun, 05 Apr 2009 15:45:39 Z2009-04-05T16:04:09Z