Last post Feb 14, 2007 11:00 AM by dimeric
May 23, 2006 02:42 PM|dirtsch|LINK
I have a problem to create Thumbnails of photos... I have a photo gallery where my friends can upload photos. When they save the photo I generate automatically thumbnails for the preview.
Now my problem. On my local machine functions it without problems. If I make a upload, there will appear the Thumbnail in the folder. But if i put it on the server and will upload some photo, there is no photo uploaded. If I'm not making a Thumbnail, and
Upload the photo without change it works, only with creating this Thumbnail it's not working... Why that ?
Thats my code:
private bool CreateImage(string Source, string Target, int MaxSize)
// load source image
Bitmap SourceBitmap = new Bitmap(Source);
Size s = new Size();
// calculate size from MaxSize
if (SourceBitmap.Width > SourceBitmap.Height)
s.Width = MaxSize;
s.Height = Convert.ToInt32((double)1 / SourceBitmap.Width * MaxSize * SourceBitmap.Height);
s.Width = Convert.ToInt32((double)1 / SourceBitmap.Height * MaxSize * SourceBitmap.Width);
s.Height = MaxSize;
// load new image
Bitmap TargetBitmap = new Bitmap(s.Width, s.Height);
Graphics bmpGraphics = Graphics.FromImage(TargetBitmap);
// set some quality properties
bmpGraphics.InterpolationMode = InterpolationMode.High;
bmpGraphics.SmoothingMode = SmoothingMode.AntiAlias;
// generate the new image with the rectangle-size
Rectangle FinalRectangle = new Rectangle(0, 0, s.Width, s.Height);
// save the new image in the /images subfolder of the web-root
Feb 10, 2007 07:26 AM|Irfanmcsd|LINK
see the link below to sort your problem out.
Creating thumbnail from Images
Feb 14, 2007 11:00 AM|dimeric|LINK
Have you set write permissions on the target folder on your server?
If not this might be the problem.