Questions About Readimageblob

Imagick rendering a black image

I'm trying to convert a SVG into PNG but I'm having trouuble with it.

With this link you can upload a SVG and the file will show the result:

The SVG that I'm trying to upload is this:

My code on the upload page is this:

if ( $_FILES ){
$target_path = 'output/'. basename( $_FILES['uploadedfile']['name']);
$mime = $_FILES['uploadedfile']['type'];

if ( $_FILES['uploadedfile']['error'] ){
    die( 'Error on upload.');

if ( move_uploaded_file( $_FILES['uploadedfile']['tmp_name'], $target_path ) ){
    echo '<embed style="border:solid 1px gray;" src="'.$target_path.'" type="image/svg+xml" pluginspage="" /><br / >';

error converting image by imagemagick

when I try to convert via php my svg file to ex. png file i get this error:

    $filename = '507e6221c9f0f.svg';
    $content = file_get_contents($filename);
    $im = new Imagick();

Fatal error: Uncaught exception 'ImagickException' with message 'no decode delegate for this image format `' @ blob.c/BlobToImage/347' in..

however when I do this via commend line everything is ok. I would use php exec() command, but I'm using PHP + IIS server, so I don't wanna to grant permission to use cmd.exe by IUSR user (the IIS user)

can anyone tell me how to fix this problem?

How do I process jpg files using ImageMagick (IMagick API)? I am getting an exception, NoDecodeDelegateForThisImageFormat, whenver I try

I am using ImageMagick with the PHP IMagick API to process uploaded jpg files - however, when I try to read a Blob or even read a physical file, I get a NoDecodeDelegateForThisImageFormat exception.

An example of the code I am using is below:

private function resizeImageBlob($blob, $width, $height) {
    $image = new Imagick();
    $image->resizeImage($width, $height, IMAGICK::FILTER_LANCZOS, 1);
    $resizedBlob = $image->getImageBlob();

    return $resizedBlob;

The image that the blob represents is a jpg image, but ImageMagick throws the exception when it tries to read the line:


Does anybody know why this might be happening?