Jump to content

Check Image dimension


datla

Recommended Posts

I want to validate the dimension of the uploading image by javascript in IE 6.0 7.0, Netscape and Firefox browser . The dimension must be 289x66.Image in local.I used this function but it work in IE 7.0 and firefox

function checkImageDimensions (filename) {            var imgURL = 'file:///' + filename;	        var img = new Image();	        if (document.layers && location.protocol.toLowerCase() != 'file:' && navigator.javaEnabled()){	    	        netscape.security.PrivilegeManager.enablePrivilege('UniversalFileRead');	        }		        img.src = imgURL;            if (img.width != 289 || img.height != 66){                                alert("error");            }             else{                alert("error");            }       }

thanks

Link to comment
Share on other sites

What? IE6 is unsupported? What are you talking about? 50% of all users still use IE6!
That's only because they don't care to download or their web software is incompatible with it. MATC (Tech College) can't update to IE7 because of problems when the Microsoft Smart Editor tries to load.
Link to comment
Share on other sites

so, the fact is it is still widely used. Just because you choose to ignore IE6 doesn't mean it is unsupported.
If you don't like my views, you could always talk to people who come over to Ovbb.org, they don't support IE6 because it doesn't support PNG24 transparencies.
Link to comment
Share on other sites

That is crazy. Until just a few months ago IE6 represented 80% of users. Were you telling your clients that?So you ignore Google (50% of searchs) you ignore IE6(50% of users), plus ignore standards all together, you have eliminated a lot of your possible user base before you even get started. How do you consider that a good thing?

Link to comment
Share on other sites

i dont think quarreling works in anyway. i would like to hear the solution instead. i believe all of us, especial datla, want your solutions rather than that :)

Link to comment
Share on other sites

How do you know it is not working?According to your code

if (img.width != 289 || img.height != 66){alert("error");}else{alert("error");}

You are going to get an error popup whether it passes ro not.

Link to comment
Share on other sites

How do you know it is not working?According to your code
if (img.width != 289 || img.height != 66){alert("error");}else{alert("error");}

You are going to get an error popup whether it passes ro not.

thank you very much. I'll try
Link to comment
Share on other sites

so, the fact is it is still widely used. Just because you choose to ignore IE6 doesn't mean it is unsupported.
Check out my site in IE6 after I put the XHTML/Valid code in. Note that my newsbox doesn't exist and that my wrapper is missing. But it looks fine in other browsers.iyeru42--XHTMLProblems.png
Link to comment
Share on other sites

We all know that IE6 falls short when it comes to web standards but it is a very commonly used browser so most developers choose to take the extra time to make it work with IE6 aswell. Read about conditional comments, it lets you use different stylesheets for IE so you don't have to resort to CSS hacks.Most of my clients still use IE6, if I told them that I was no longer going to support it then I would be bankrupt in a week because nobody would hire me because my websites would be unusable for 50% of their users.It is not a matter of liking IE6 or thinking it is a good browser, it is a matter of making myself and my skills marketable and accomodating as many users as possible.

Link to comment
Share on other sites

I don't know anything about:

netscape.security.PrivilegeManager.enablePrivilege('UniversalFileRead');
But it has been my experience that it is not possible to view any of the details (i.e. dimensions of an image, file size, last modified date) of a file that resides on a client computer using javascript. My guess is that you'll have to allow the file to be uploaded to the server and have your server-side code view the details of the file and then decide whether the file matches your criteria or not.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...