如何让jQuery获得以字节为单位的图像大小,而不是图像尺寸? [英] How to have jQuery get image size in bytes, not image dimensions?

查看:52
本文介绍了如何让jQuery获得以字节为单位的图像大小,而不是图像尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery 1.7.1.

I am using jQuery 1.7.1.

在浏览器窗口中加载图像后,我想检索其总字节大小.是否有一个对象名称/值?

After an image loads in the browser window, I want to retrieve its total byte size. Is there an object name / value for that?

推荐答案

不,您无法使用jQuery或纯JavaScript获取图像大小.唯一的方法是使用ajax从服务器端获取它.

No, there is no way you can get the image size using jQuery or pure JavaScript. The only way is to get it from server side using ajax.

您可以获取图像URL,并将其发送到服务或服务器端页面,并使该页面或服务返回图像大小.

You can get the image url send it to a service or server side page and have the page or service return the image size.

这篇关于如何让jQuery获得以字节为单位的图像大小,而不是图像尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆