Imagick::getImagesBlob

(PECL imagick 2, PECL imagick 3)

Imagick::getImagesBlobReturns all image sequences as a blob

说明

public Imagick::getImagesBlob(): string

Implements direct to memory image formats. It returns all image sequences as a string. The format of the image determines the format of the returned blob (GIF, JPEG, PNG, etc.). To return a different image format, use Imagick::setImageFormat().

参数

此函数没有参数。

返回值

Returns a string containing the images. On failure, throws 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