PHP Conference Japan 2024

Imagick::getImageLength

(PECL imagick 2, PECL imagick 3)

Imagick::getImageLength傳回影像的位元組長度

說明

public Imagick::getImageLength(): int

傳回影像的位元組長度

參數

此函式沒有參數。

傳回值

傳回一個包含目前影像大小的整數。

範例

範例 #1 使用 Imagick::getImageLength()

取得影像的位元組長度

<?php
$image
= new Imagick('test.jpg');
echo
$image->getImageLength() . ' bytes';
?>

新增註解

使用者貢獻的註解 1 則註解

seb dot gibbs at ymail dot com
1 年前
讀取 jpeg 圖片二進位資料時,檔案大小經常會增加!

例如:

$img = new Imagick();
$img->readImage($filename);

$sizeA = $img->getImageLength();
$blobdata = $img->getImageBlob();
$sizeB = $img->getImageLength();

根據讀取的 jpeg 圖片,sizeB 通常會大於 sizeA
To Top