PHP Velho Oeste 2024

Imagick::getImagesBlob

(PECL imagick 2, PECL imagick 3)

Imagick::getImagesBlobすべての画像シーケンスを blob で返す

説明

public Imagick::getImagesBlob(): string

メモリ上の画像フォーマットを直接操作します。 すべての画像シーケンスを文字列として返します。 画像のフォーマット (GIF, JPEG, PNG など) に応じて返される blob の形式も異なります。 別の画像フォーマットで返すには Imagick::setImageFormat() を使用します。

パラメータ

この関数にはパラメータはありません。

戻り値

画像を文字列で返します。失敗した場合は ImagickException をスローします。

add a note add a note

User Contributed Notes 1 note

up
1
merajsiddiqui at outlook dot com
7 years ago
Binary Large OBject (BLOB) format is used to store image, audio, video directly into database and not into a file system and then saving the location in the database.
To store an image in database you can directly use Imagic library to convert the image into BLOB

<?php
$imagick
= new Imagick();
//Your image file
$image = dirname(__DIR__) . "/example/images/github_logo.png";
$image_file = fopen($image, "a+");
$imagick->readImageFile($image_file);
//if not applied utf-8 encode it throws decoding error output not utf-8
$image_blob = utf8_encode($imagick->getImagesBlob());
var_dump($image_blob);
To Top