我需要知道 PHP 中是否有任何可用的方法可以通过它创建 300ppi 的图像?我看到了 GD 库的文档,但找不到任何信息。有什么方法可以处理图像并设置ppi吗?
或者,闪存中是否有任何方法可以转换图像分辨率?
谢谢
玛尼
我需要知道 PHP 中是否有任何可用的方法可以通过它创建 300ppi 的图像?我看到了 GD 库的文档,但找不到任何信息。有什么方法可以处理图像并设置ppi吗?
或者,闪存中是否有任何方法可以转换图像分辨率?
谢谢
玛尼
这是您可以使用的示例代码:
imagejpeg($image, $file, 75);
// Change DPI
$dpi_x = 300;
$dpi_y = 300;
$image = file_get_contents($file);
// Update DPI information in the JPG header
$image[13] = chr(1);
$image[14] = chr(floor($dpi_x/255));
$image[15] = chr($dpi_x%255);
$image[16] = chr(floor($dpi_y/255));
$image[17] = chr($dpi_y%255);
// Write the new JPG
file_put_contents($file, $msg);