This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
sunil  
#1 Posted : Friday, January 25, 2008 5:10:39 PM(UTC)
sunil

Rank: Newbie

Groups: Guest
Joined: 1/16/2008(UTC)
Posts: 1

HI all i am using Graphics Mill to set a image in the psd file but i am getting error

when i reach this following code

Aurigma.GraphicsMill.Bitmap photo = new Aurigma.GraphicsMill.Bitmap(stream);

i am using the code

if (fpUplaodLogo.HasFile)

{

using (BinaryReader reader = new BinaryReader

(fpUplaodLogo.PostedFile.InputStream))

{

image = (byte[])(reader.ReadBytes

(fpUplaodLogo.PostedFile.ContentLength));

// SaveImage(image);

}

}

//byte[] data = (byte[])(["Photo"]);

System.IO.MemoryStream stream = new System.IO.MemoryStream();

int offset = 78;

stream.Write(image, offset, image.Length - offset);

try

{

Aurigma.GraphicsMill.Bitmap photo = new Aurigma.GraphicsMill.Bitmap(stream);

updatedLayers.Add("image", photo);

updatedLayers.Add("title1", txtComNm.Text);

updatedLayers.Add("title2", txtCompDesc.Text);

updatedLayers.Add("heading ", txtComNm.Text);

imgFastTrackPsd.Visible = true;

BitmapViewer1.Bitmap = RasterizePsd(Server.MapPath("/psdimage/Add2.psd"), updatedLayers);

}

catch (Aurigma.GraphicsMill.Codecs.MediaUnsupportedException)

{

updatedLayers.Add("title1", txtComNm.Text);

updatedLayers.Add("title2", txtCompDesc.Text);

updatedLayers.Add("heading ", txtComNm.Text);

updatedLayers.Add("subheading", txtCompDesc.Text);

updatedLayers.Add("salary-details", txtAbtUs.Text);

updatedLayers.Add("locations-details", txtLoc.Text);

// updatedLayers.Add("aboutus", txtAbtUs.Text);

updatedLayers.Add("keyrequirements-details", txtKeyRequirement.Text);

updatedLayers.Add("whyshouldyouapply-details", txtYApply.Text);

updatedLayers.Add("numberofpositions-details", txtNoPos.Text);

updatedLayers.Add("other-details", txtOthers.Text);

updatedLayers.Add("joborderdetails-details", txtJODet.Text);

imgFastTrackPsd.Visible = true;

BitmapViewer1.Bitmap = RasterizePsd(Server.MapPath("/psdimage/Spotlighter-Add2.psd"), updatedLayers);

}

my problem is that when i upload a jpg image i am getting MediaUnsupportedException error . any help most appreciated can u pls any one tell where i am worng

thanks and regards,

sunil T

Edited by user Friday, January 25, 2008 5:12:46 PM(UTC)  | Reason: Not specified

Alex Kon  
#2 Posted : Friday, February 1, 2008 4:38:59 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Guest
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hello,

It is hard to debug code on the forum, but I will try :) I need some additional information, so could you answer the following questions:

1) On which line of the posted code exception is thrown? Here?

Code:
Aurigma.GraphicsMill.Bitmap photo = 
       new Aurigma.GraphicsMill.Bitmap(stream);

2) Why do you cut off the first 78 bytes of the input stream?

Code:

image = (byte[])reader.ReadBytes(
       fpUplaodLogo.PostedFile.ContentLength);
...
System.IO.MemoryStream stream = new System.IO.MemoryStream();

int offset = 78;
stream.Write(image, offset, image.Length - offset);
...
Aurigma.GraphicsMill.Bitmap photo = 
       new Aurigma.GraphicsMill.Bitmap(stream);

And I think that there should be MemoryStream.Seek() method call to move stream position to the begin of source data before Aurigma.GraphicsMill.Bitmap constructor call.

Edited by user Friday, February 1, 2008 4:40:42 PM(UTC)  | Reason: Not specified

Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.