2

我用 getimagesize 构建了一个简单的函数来确定图像是水平的还是垂直的。

// get height and width and then return
list($width, $height) = getimagesize('/path/to/imag.jpg');
if ($width > $height || $width == $height) {
    return 'HORIZONTAL';
} elseif ($height > $width) {
    return 'VERTICAL';
}

但这似乎在某些图像上失败了。特别是在使用移动设备拍摄的照片上,将其垂直放置。Photoshop 打开它并垂直显示它,Mac Preview 也是如此,但 getimagesize 一直告诉我宽度大于高度。

所以我假设信息,这个“水平”图像应该在照片应用程序中显示“垂直”存储在其他地方......

但是在哪里...... Exif?

4

0 回答 0