问题描述
我有这些图像正在使用PHP从服务器和数据库中删除
I have these images that I am getting off my server and a database using PHP
<div class="pics">
<img src="upload/<?php echo $array['image'] ?>" height="200"/>
</div>
实际尺寸很大,但我需要它们的高度都在200以内.
There actual sizes are huge, but I need them to all be at a height at 200.
如何使用jQuery查找此图像的宽度,我在任何地方都找不到教程....
How do I find the width of this image using jQuery, I cant find a tutorial anywhere....
任何帮助将不胜感激.
感谢您的宝贵时间,
推荐答案
我会尝试使用.innerWidth()
而不是.width()
,因为.width()
会包含边距.
I would try .innerWidth()
instead of .width()
, as .width()
would include the margin.
$('img').innerWidth();
如果您的图片确实很大,则应考虑在服务器端将其缩小.
If your image is really that big, you should consider scaling it down it server-side.
实际上.width()
并没有添加边距,甚至没有添加填充.这使得.width()
比.innerWidth()
更合适.谢谢SKS.
Actually .width()
is not adding the margin and furthermore its not even adding the padding. That makes .width()
more suitable than .innerWidth()
. Thanks SKS.
这篇关于使用jQuery找出图像的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!