[英]How to get the width and height of an image by Url in Google Sheets
I have in a Google Sheet a list of images by URL.我在 Google Sheet 中有一个按 URL 列出的图像列表。 Images are on a remote server.图像位于远程服务器上。 I got the preview in my Sheet by the Image (URL) function.我通过图像 (URL) 功能在我的工作表中获得了预览。
Is there a way to get the width and height of each remote image in each row by formula or script?有没有办法通过公式或脚本获取每行中每个远程图像的宽度和高度?
Looking through the Google Community docs, found this question asked here with no apparent solution.查看谷歌社区文档,发现这里提出的这个问题没有明显的解决方案。
It's not exactly what you're looking for, but you could use the IMAGE
function to set the dimensions your images.这并不完全是您要查找的内容,但您可以使用IMAGE
函数来设置IMAGE
的尺寸。
IMAGE(url, [mode], [height], [width])图像(网址,[模式],[高度],[宽度])
url - The URL of the image, including protocol (eg http://). url - 图像的 URL,包括协议(例如 http://)。
The value for url must either be enclosed in quotation marks or be a reference to a cell containing the appropriate text. url 的值必须用引号括起来,或者是对包含适当文本的单元格的引用。 mode - [ OPTIONAL - 1 by default ] - The sizing mode for the image模式 - [ 可选 - 默认为 1 ] - 图像的大小调整模式
1 resizes the image to fit inside the cell, maintaining aspect ratio. 1 调整图像大小以适应单元格,保持纵横比。
2 stretches or compresses the image to fit inside the cell, ignoring aspect ratio. 2 拉伸或压缩图像以适应单元格,忽略纵横比。
3 leaves the image at original size, which may cause cropping. 3 使图像保持原始大小,这可能会导致裁剪。
4 allows the specification of a custom size. 4 允许自定义尺寸的规格。
Note that no mode causes the cell to be resized to fit the image.请注意,没有任何模式会导致单元格调整大小以适合图像。
height - [ OPTIONAL ] - The height of the image in pixels.高度 - [ 可选 ] - 图像的高度(以像素为单位)。 mode must be set to 4 in order to set a custom height. mode 必须设置为 4 才能设置自定义高度。
width - [ OPTIONAL ] - The width of the image in pixels.宽度 - [ 可选 ] - 图像的宽度(以像素为单位)。 mode must be set to 4 in order to set a custom width. mode 必须设置为 4 才能设置自定义宽度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.