获取图像高度和宽度作为整数值? [英] Get Image Height and Width as integer values?

查看:84
本文介绍了获取图像高度和宽度作为整数值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用PHP函数 getimagesize ,但是我无法将图像的宽度和高度提取为整数值.

I've tried to use the PHP function getimagesize, but I was unable to extract the image width and height as an integer value.

我该如何实现?

推荐答案

尝试如下:

list($width, $height) = getimagesize('path_to_image');

请确保:

  1. 您在此处指定正确的图像路径
  2. 图片具有读取权限
  3. 将Chmod映像目录更改为755

还尝试使用$_SERVER["DOCUMENT_ROOT"]前缀路径,这有时在您无法读取文件时会有所帮助.

Also try to prefix path with $_SERVER["DOCUMENT_ROOT"], this helps sometimes when you are not able to read files.

这篇关于获取图像高度和宽度作为整数值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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