Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Can I use Phalcons Imagick with file_get_contents?

Hello. Tell me please, can I use Phalcon's Imagick with file_get_contents? Or only php-imagick?


Phalcon Imagick class gets at the entrance file . file_get_contents reads entire file into a string. So you need return file from a string with correctly headers. You can use base64 format. Maybe like this:

$file = 'http://you/file/path.jpg';
$data = base64_encode(file_get_contents($file));

$image = new \Phalcon\Image\Adapter\Imagick( 'data: '.mime_content_type($file).';base64,'.$data);