Imagick::pingImageBlob()函数是PHP中的内置函数,可用于查询图像属性而无需将完整图像加载到内存中。它可用于查询图像的宽度,高度,大小和格式。它以整个图像流为参数。
用法:
bool Imagick::pingImageBlob( $image )
参数:此函数接受单个参数$image,它是包含图像流的字符串。
返回值:成功时此函数返回True。
以下示例程序旨在说明PHP中的Imagick::pingImageBlob()函数:
程序:该程序将显示图像的高度和宽度,而无需实际将其加载到屏幕上。
<?php
// Read a file in form of string
$image = file_get_contents(
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-6.png');
// Create new Imagick object
$imagick = new Imagick();
// Use Imagick::pingImageBlob() function
$imagick->pingImageBlob($image);
// Get the details of the image
echo "Width of image: " . $imagick->getImageWidth() . "<br>" .
"Height of image: " . $imagick->getImageHeight();
?>
输出:
Width of image: 600 Height of image: 135
参考: https://www.php.net/manual/en/imagick.pingimageblob.php
相关用法
- PHP Imagick distortImage()用法及代码示例
- PHP Imagick readImage()用法及代码示例
- PHP Imagick readImageFile()用法及代码示例
- PHP Imagick remapImage()用法及代码示例
- PHP Imagick readImages()用法及代码示例
- PHP Imagick getCopyright()用法及代码示例
- PHP Imagick extentImage()用法及代码示例
- PHP Imagick separateImageChannel()用法及代码示例
- PHP Imagick sepiaToneImage()用法及代码示例
- PHP Imagick setColorspace()用法及代码示例
- PHP Imagick despeckleImage()用法及代码示例
- PHP Imagick convolveImage()用法及代码示例
- PHP Imagick enhanceImage()用法及代码示例
- PHP Imagick encipherImage()用法及代码示例
- PHP Imagick equalizeImage()用法及代码示例
注:本文由纯净天空筛选整理自piyush25pv大神的英文原创作品 PHP | Imagick pingImageBlob() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。