【发布时间】:2017-07-10 14:17:08
【问题描述】:
我正在尝试确定以下文件扩展名的 DPI:
- jpg
- png
- psd
- tiff
- 爱
- 每股收益
对于 jpg,我使用以下方法:
$exif = \exif_read_data( $file->getPathname() );
if ( isset( $exif['XResolution'], $exif['YResolution'] ) ) {
$resolutionX = \explode( '/', $exif['XResolution'] );
$resolutionY = \explode( '/', $exif['YResolution'] );
// defaults to 300 to make sure an image is not denied when DPI get not be determined
$dpiX = ( $resolutionX[0] ?? 300 ) / ( $resolutionX[1] ?? 1 );
$dpiY = ( $resolutionY[0] ?? 300 ) / ( $resolutionY[1] ?? 1 );
}
现在如何在不在我的服务器上安装其他软件的情况下对上述格式执行相同的操作?
更新: png 也可以。
【问题讨论】: