[ExternalException (0x80004005): A generic error occurred in GDI+.]
IpitchitImageHandler.Data.ImageRepository.AddNewTempImage(Stream image, String extension, Guid PageId, Guid ImageId, ImageTransformCollection toDoTransforms) +1967
IpitchitImageHandler.Data.ImageRepository.AddNewTempImage(Stream image, String extension, Guid PageId, Guid ImageId) +85
IpitchitWeb.Sell.Controls.UploadImagesSubstep.UploadImages(Object sender, EventArgs e) in F:\Documents and Settings\Vjeran\My Documents\Visual Studio 2008\Projects\Ipitchit\IpitchitWeb\Sell\Controls\UploadImagesSubstep.ascx.cs:88
System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +111
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +79
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
my code is:
public void AddNewTempImage(Stream image, string extension, Guid PageId, Guid ImageId,
ImageTransformCollection toDoTransforms)
{
//mapping steam to memory stream so it does support the seek
MemoryStream targetStream = new MemoryStream(ReadStream(image, 1024));
Image ImageToTransform=null;
Image transformedImage = null;
string storagePath = ImageTransformManager.Config.StorageServerPhysicalPath;
Uri storageUrl = new Uri(ImageTransformManager.Config.StorageServerUrl);
//string TempPath = Path.Combine(storagePath, GenerateFileName(extension));
//SaveStream(TempPath, image);
//File.WriteAllBytes(TempPath, ReadStream(image, 1024));
if (!HttpContext.Current.User.Identity.IsAuthenticated)
throw new Exception("Nonauthenticated users image submition is not supported");
try
{
foreach (ImageTransform transform in toDoTransforms)
{
ImageRepositoryTempImage newimage = new ImageRepositoryTempImage();
newimage.ImageGuid = ImageId;
newimage.PageGuid = PageId;
newimage.CreatedBy = HttpContext.Current.User.Identity.Name;
newimage.CreatedDate = DateTime.UtcNow;
newimage.Format = transform.OutputType;
newimage.Width = transform.Width;
newimage.Height = transform.Height;
newimage.Watermark = transform.UseWaterMark;
string filename = GenerateFileName(transform.OutputType);
string fullStoragePath = Path.Combine(storagePath, Path.Combine(transform.StorageFolder, filename));
string fullStorageUrl = CombineUri(storageUrl, Path.Combine(transform.StorageFolder, filename));
newimage.PhysicalStoragePath = fullStoragePath;
newimage.StoragePath = fullStorageUrl;
CheckOrAddImageTransform(transform);
var ImgRepTransform = GetTransformation(transform);
newimage.ImageRepositoryTransformation = ImgRepTransform;
newimage.TransformId = ImgRepTransform.Id;
Bitmap uploaded = new Bitmap(image);
ImageToTransform = (Image)uploaded.Clone();
uploaded.Dispose();
transformedImage = transform.Transform(ImageToTransform);
AddNewTempImage(newimage);
//adding named watermark and transformation
string wname = ImageTransformManager.Config.WaterMarkName;
string wpath = ImageTransformManager.Config.WaterMarkPath;
ChechOrAddWaterMark(wname, wpath);
if (!(string.IsNullOrEmpty(wname) && string.IsNullOrEmpty(wpath)))
newimage.ImageRepositoryWaterMark = GetWatermark(wname, wpath);
transformedImage.Save(fullStoragePath, GetFormat(newimage.Format));
}
}
catch (System.Exception ex)
{
ErrorHandling.LogErrorEvent("Add new temp image method", ex);
throw ex;
}
finally
{
//File.Delete(TempPath);
if (ImageToTransform!=null)
ImageToTransform.Dispose();
image.Dispose();
targetStream.Dispose();
if (transformedImage != null)
transformedImage.Dispose();
}
}
On my local machine everything works - but still happens.. on server (2003) - i have folder permissions .. and everything...