• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

resize am imagen from database before show in the control imagen

Hello all,
I've a process to fetch images from database to the image control the code is a .ashx file and this is.

  Dim o As Object = command.ExecuteScalar
        If o Is Nothing Or IsDBNull(o) Then
       
        Else
            Dim d As Byte() = CType(command.ExecuteScalar(), Byte())
            output.Write(d, 0, d.Length)
        End If

Well it's working but now I have to control the image's size, I was thinking to do in this code, but my first problem is...

How Can I transform the d "BYTE()" into an object image to perform all the changes easily.

any idea?

thanks.  
0
limmontreefree
Asked:
limmontreefree
  • 2
1 Solution
 
HainKurtSr. System AnalystCommented:
first of all you execute it twice, change this line

     Dim d As Byte() = CType(command.ExecuteScalar(), Byte())
-->
     Dim d As Byte() = CType(o, Byte())
0
 
HainKurtSr. System AnalystCommented:
to convert a byte array to image you can use the code here

http://www.codeproject.com/KB/recipes/ImageConverter.aspx
0
 
limmontreefreeAuthor Commented:
fully successful

thanks
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now