Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试从第三方 url 获取图像宽度,并想质疑它的宽度是否为 1px,然后做一些事情。在 JSP/JSTL 中最好的方法是什么?我只有图像源网址,它有时会提供 1px 宽度的图像,有时会提供 100px 宽度的图像。
<img border="0" class="chatButton" src="http://abc.com/img.aspx">
你可以使用类似的东西
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <c:import var="img" url="http://abc.com/img.aspx"/> ${fn:length(img)}
这将为您提供以字节为单位的图像大小,并为您提供区分两个图像的方法。