简体   繁体   English

如何设置图像的高度和宽度?

[英]how to set image height and width?

i want one information how will we set constant image height and width using javascript means if we set height 50 and width 65 so only that much size image will insert if user start to insert more than condition one alert message will come iam write code but it not work 我想要一个信息,我们将如何使用javascript设置恒定的图像高度和宽度,如果我们将高度和宽度设置为50和65,以便在用户开始插入多个条件的情况下仅插入那么多尺寸的图像,一条警报消息会通过iam编写代码,不行

 if((obj.FileUp.value.width>67)&&(obj.FileUp.value.height>380))
            {
            alert("Height of image should not be more than 67 And Width of image should not be more than 380");
               return false;
                //alert(obj.FileUp.width)

            }

I don't believe that you can interact directly with an uploaded file like this in javascript. 我不认为您可以直接在javascript中与上传的文件进行交互。

You could use a flash upload plugin such as Plupload , or you can check the size on the server, though I guess this might defeat the purpose. 您可以使用Flash上​​载插件(例如Plupload) ,也可以检查服务器上的大小,尽管我猜这可能会达到目的。

I found this page which appears to be the example you need: 我发现此页面似乎是您需要的示例:

http://www.chestysoft.com/upload/jsdemo.asp http://www.chestysoft.com/upload/jsdemo.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM