I am trying to create svg image using svg raw data which i am getting from fabric js. I have used below code to generate the svg using svg raw data but its not working properly.
public function generate_svg($raw_svg='',$prefix='',$folder_name='card_image')
{
$file_name = '';
if($raw_svg!='')
{
try{
$file_name = uniqid($prefix).".svg";
$image = new \Imagick();
$image->readImageBlob($raw_svg);
$image->setImageFormat("svg");
$image->writeImage($folder_name.$file_name);
} catch (ImagickException $ex) {
echo $ex->getMessage();
}
}
return $file_name;
}
Now the issue is background image is kind of Look like below:
So what should i do to fix that?
It should look like below (ignore the square and round), the issue is whole background looks like black instead of bg image.:
So the issue is background image is not loading, so do i have to add additional library to do that or any thing else?
Imagick Version: 6.7.7
convert -list delegate | grep svg
cdr => "uniconvertor' '%i' '%o.svg'; /bin/mv '%o.svg' '%o"
cgm => "uniconvertor' '%i' '%o.svg'; /bin/mv '%o.svg' '%o"
dot => "dot' -Tsvg '%i' -o '%o"
dxf => "uniconvertor' '%i' '%o.svg'; /bin/mv '%o.svg' '%o"
fig => "uniconvertor' '%i' '%o.svg'; /bin/mv '%o.svg' '%o"
svg => "rsvg-convert' -o '%o' '%i"
convert -list format | grep SVG
MSVG rw+ ImageMagick's own SVG internal renderer
SVG rw+ Scalable Vector Graphics (XML 2.9.1)
SVGZ rw+ Compressed Scalable Vector Graphics (XML 2.9.1)