Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Conversion issue: Image>Byte array>Image

Reply
Thread Tools

Conversion issue: Image>Byte array>Image

 
 
=?Utf-8?B?RGVhc3Vu?=
Guest
Posts: n/a
 
      07-14-2005
Heres the code I have:

Dim objTheStream As MemoryStream = New MemoryStream
Dim objPhoto As Image = pic_PhotoToUpload.Image()
With objPhoto
.Save(objTheStream, System.Drawing.Imaging.ImageFormat.Jpeg)
End With
Dim objByteToSend(objTheStream.Length) As Byte
objByteToSend = objTheStream.ToArray()

Dim objPhoto2 As Image
Dim objTheStream2 As MemoryStream = New
MemoryStream(objByteToSend, 0, objByteToSend.Length)
objTheStream2.Write(objByteToSend, 0,
objByteToSend.Length)
objPhoto2.FromStream(objTheStream, True)

Why does objPhoto2 = nothing after that last line ?

Thanks
Deasun
--
Deasun
Home Site: www.tirnaog.com
Check out: The Code Vault in my forums section.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmFzb24gTCBMaW5k?=
Guest
Posts: n/a
 
      07-14-2005
Don't you want to be calling stream2 there?

Jason Lind

"Deasun" wrote:

> Heres the code I have:
>
> Dim objTheStream As MemoryStream = New MemoryStream
> Dim objPhoto As Image = pic_PhotoToUpload.Image()
> With objPhoto
> .Save(objTheStream, System.Drawing.Imaging.ImageFormat.Jpeg)
> End With
> Dim objByteToSend(objTheStream.Length) As Byte
> objByteToSend = objTheStream.ToArray()
>
> Dim objPhoto2 As Image
> Dim objTheStream2 As MemoryStream = New
> MemoryStream(objByteToSend, 0, objByteToSend.Length)
> objTheStream2.Write(objByteToSend, 0,
> objByteToSend.Length)
> objPhoto2.FromStream(objTheStream, True)
>
> Why does objPhoto2 = nothing after that last line ?
>
> Thanks
> Deasun
> --
> Deasun
> Home Site: www.tirnaog.com
> Check out: The Code Vault in my forums section.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGVhc3Vu?=
Guest
Posts: n/a
 
      07-14-2005
thanks for the reply.
Just had to make objPhoto2 = objPhoto2.FromStream(objTheStream, True)
And it works.

--
Deasun
Home Site: www.tirnaog.com
Check out: The Code Vault in my forums section.


"Jason L Lind" wrote:

> Don't you want to be calling stream2 there?
>
> Jason Lind
>
> "Deasun" wrote:
>
> > Heres the code I have:
> >
> > Dim objTheStream As MemoryStream = New MemoryStream
> > Dim objPhoto As Image = pic_PhotoToUpload.Image()
> > With objPhoto
> > .Save(objTheStream, System.Drawing.Imaging.ImageFormat.Jpeg)
> > End With
> > Dim objByteToSend(objTheStream.Length) As Byte
> > objByteToSend = objTheStream.ToArray()
> >
> > Dim objPhoto2 As Image
> > Dim objTheStream2 As MemoryStream = New
> > MemoryStream(objByteToSend, 0, objByteToSend.Length)
> > objTheStream2.Write(objByteToSend, 0,
> > objByteToSend.Length)
> > objPhoto2.FromStream(objTheStream, True)
> >
> > Why does objPhoto2 = nothing after that last line ?
> >
> > Thanks
> > Deasun
> > --
> > Deasun
> > Home Site: www.tirnaog.com
> > Check out: The Code Vault in my forums section.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PSD to XHTML Conversion Services and PSD to HTML CSS ConversionServices, PSD to Joomla, Drupal, Wordpress Conversion xhtml champs Python 0 06-21-2011 11:59 AM
PSD to XHTML Conversion Services and PSD to HTML CSS ConversionServices, PSD to Joomla, Drupal, Wordpress Conversion PSD to XHTML Conversion Services and PSD to HTML CSS Conversion Services, PSD to Joomla, Drupal, Wor VHDL 0 04-25-2011 06:43 AM
conversion operator and conversion ctor subramanian100in@yahoo.com, India C++ 2 09-15-2009 12:46 PM
Date conversion problem with OE importing saroxonline76@vodafone.it Firefox 0 07-12-2005 07:38 PM
Framework 1.0 to 1.1 conversion Luc Bisson ASP .Net 2 11-19-2003 02:40 AM



Advertisments