Morcos Adel

Morcos Adel

  • NA
  • 195
  • 49.5k

Thumbnail Problem

Jun 14 2011 3:54 AM
Hi...
i ran into a strange problem while trying to create thumbnails which is :
system.io.filenotfoundexception..
Scenario:
i have a fileupload control which i can select an image and upload it to another server using a web service when uploading the image i try to create a thumbnail of the image and upload it to a diffrent location....the problem is on my local machine while debugging it works fine but when the application is published on the server it gives me system.io.filenotfoundexception and it is thrown only for the thumbnail because the image is saved in its location only the thumbnail not saved......

Code for Creating the Thumbnail:

public

{

System.Drawing.Image image = System.Drawing.Image.FromFile(Filename);

System.Drawing.



MemoryStream Stream = new MemoryStream();
Thumbnail.Save(Stream, ImageFormat.Jpeg);



byte[] imageContent = new Byte[Stream.Length];

Stream.Position = 0;


return imageContent;

}

public bool ThumbnailCallBack()

{

return true;

}

And This is the code for the page:

String ImageDestination=Configurationmanager.appsettings["Uploads"].tostring()+"\\Images\\" +ImageName;

uploadservice.uploadFile(ImageUpload.filebytes,ImageDestination);

String ThumbnailDestination=Configurationmanager.appsettings["Uploads"].tostring()+"\\Images\\"+"\\Thumbs\\"+Imagename;

uploadsevice.uploadFile(Thumbnail(ImageUpload.postedfile.Filename),ThumbnailDestination);


i hope i explained it right,any ideas???
thanks in advance...

Stream.Read(imageContent, 0, (int)Stream.Length);
Image Thumbnail = image.GetThumbnailImage(50, 50, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallBack), IntPtr.Zero);
byte[] Thumbnail(String Filename)

Answers (1)