Fixed uploading issues with PNG, it seems this format can't be written to a network stream (non seekable)

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2127 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-10-08 20:09:06 +00:00
commit da03cf3002

View file

@ -416,8 +416,16 @@ namespace GreenshotPlugin.Core {
formDataStream.Write(Encoding.UTF8.GetBytes(header), 0, Encoding.UTF8.GetByteCount(header));
// Write the file data directly to the Stream, rather than serializing it to a string.
ImageOutput.SaveToStream(image, formDataStream, outputSettings);
if (outputSettings.Format == OutputFormat.png) {
// The PNG image formats need to be written to a seekable stream, so we need a intermediate MemoryStream
using (MemoryStream memoryStream = new MemoryStream()) {
ImageOutput.SaveToStream(image, memoryStream, outputSettings);
memoryStream.WriteTo(formDataStream);
}
} else {
ImageOutput.SaveToStream(image, formDataStream, outputSettings);
}
}
/// <summary>