Web Design Nottingham Header

Freetextbox image upload

Publication Date: Thu 19 Jun 2008

We have utilised freetextbox as a tool for our bespoke content management systems for a number of years now.

One issue we had involved the image gallery control that enables you to upload images to the server and reference them in freetextbox, it does not physically resize the image. This meant that novice users would sometimes upload 2MB images and the resulting page that was displayed took a long time to download the images.

Thankfully we found an alternative image upload component on the freetextbox forum that allows the user to specify the size of the image and the control will resize the physical image.

This was good but the resize wasn't done using a good interpolation mode which results in poor quality images like this:


Therefore, we altered the source code to resize the image using High Quality Bicubic interpolation, which produces better quality like this:


We also only allow the user to specify a width or height for the image as the resultant image should retain the aspect ratio. The code below does the resizing. I will upload all the files in a few days.

Note there seems to be a bug with the high quality bicubic resize as it leaves a black line on the top and left of the resultant image, I got around this by starting at -1,-1 on the redraw (System.Drawing.Rectangle(-1, -1, width + 1, destHeight + 1)).

private System.Drawing.Bitmap MakeImage(System.Drawing.Bitmap bmOrig, int width, string savePath)

int destHeight = bmOrig.Height * width / bmOrig.Width;

System.Drawing.Bitmap bm = new System.Drawing.Bitmap(width, destHeight,




System.Drawing.Graphics grPhoto = System.Drawing.Graphics.FromImage(bm);

grPhoto.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;


new System.Drawing.Rectangle(-1, -1, width + 1, destHeight + 1),

new System.Drawing.Rectangle(0, 0, bmOrig.Width, bmOrig.Height),




return bm;



"After being let down by two major so called web design companies Stephen and his team stepped in and helped us upgrade our existing website. The service we received has been second to none and we have now have a website that meets our exact needs."
Bev - Direct Holiday Homes

Latest Projects

Angel Wings web design Labarde web design Internet Gardener web design Stonesilver web design Build Investment Jewellery web design

Developer Certifications

MCPD logo


Comodo logo protx logo

Coding Standards


Agilis Software Limited | 2 Lynemouth Court, Arnold, Nottingham. NG5 8TY
Registered in England No. 5688723. VAT No. 886 4538 70
Tel: 07973 766989
Email: stephen@agilissoftware.co.uk