solution for imageareaselect jquery plugin problem with IE

Ref. to this tutorial :
http://www.webmotionuk.co.uk/jquery-image-upload-and-crop-for-php/

For people who has problem with IE, the problem that first click on IE get selection.width & selection.height = 0. therefore when the scaleX and scaleY divided by 0, it return Infinity. So here’s a simple Solution :
Just replace :

var scaleX = 100 / selection.width;
var scaleY = 100 / selection.height;

With :

if(selection.width != 0 && selection.height != 0) {
var scaleX = 100 / selection.width;
var scaleY = 100 / selection.height;
} else {
var scaleX = 100;
var scaleY = 100;
}
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • Netvibes
  • StumbleUpon

Tags: , , ,

Leave a Reply