Hi all
I've got the following code to add a picture in to a presentation using a URI:
//Get the image from the imgLoc URI
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(imgLoc);
using (HttpWebResponse httpWebResponse = (HttpWebResponse)request.GetResponse())
{
//Put the response in to a standard stream
Stream tempImg = httpWebResponse.GetResponseStream();
//Convert the response stream into a MemoryStream as HttpResponses are non-seekable
Byte[] tempBytes = new Byte[1024];
MemoryStream imageStream = new MemoryStream();
int bytesRead = tempImg.Read(tempBytes, 0, tempBytes.Length);
while (bytesRead > 0)
{
imageStream.Write(tempBytes, 0, tempBytes.Length);
bytesRead = tempImg.Read(tempBytes, 0, tempBytes.Length);
}
//Close the HttpResponse stream
tempImg.Close();
//Add the picture to the presentation
pic = new Picture(pres, imageStream);
//Close the MemoryStream
imageStream.Close();
}
This works fine when adding a thumbnail image (Stream size = 3,072), but when adding the full size image (Stream size = 3,385,344) I'm getting a 'Parameter is not valid' error. They're both jpegs and the URIs are definitely correct (URIs are correct and stream is getting created).
Is there a size limit when creating a Picture, or am a missing something?
Thanks
Ben