A
Antonie C Malan Snr
Dear All,
I tried posting this before, but it seems to have disappeared.
I need to check image sizes before the user uploads them. This works in
the Mozilla family on second and subsequent iterations:
if(form.photo1.value != ""){
var piccie = new Image();
piccie.src = "file://" + form.photo1.value;
if(piccie.height > 244 || piccie.height < 236 || piccie.width > 324
|| piccie.width < 316){
alert("Your photo 1 is " + piccie.width + " pixels wide and " +
piccie.height + " pixels high.\n The required dimensions are 320w
x 240h. Please scale your picture");
return false;
}
}
This means the user must try twice on the Mozilla family of browsers.
The first time a hight and width of 0 are returned.
On Opera it does not work at all. The "file://" is needed when this
runs on the server.
I don't know about MSIE as I don't have a server setup on the Windows
side of my computer and very rarely go there.
Any ideas on this? I'd be grateful.
Chris
I tried posting this before, but it seems to have disappeared.
I need to check image sizes before the user uploads them. This works in
the Mozilla family on second and subsequent iterations:
if(form.photo1.value != ""){
var piccie = new Image();
piccie.src = "file://" + form.photo1.value;
if(piccie.height > 244 || piccie.height < 236 || piccie.width > 324
|| piccie.width < 316){
alert("Your photo 1 is " + piccie.width + " pixels wide and " +
piccie.height + " pixels high.\n The required dimensions are 320w
x 240h. Please scale your picture");
return false;
}
}
This means the user must try twice on the Mozilla family of browsers.
The first time a hight and width of 0 are returned.
On Opera it does not work at all. The "file://" is needed when this
runs on the server.
I don't know about MSIE as I don't have a server setup on the Windows
side of my computer and very rarely go there.
Any ideas on this? I'd be grateful.
Chris