网站建设资讯

NEWS

网站建设资讯

phpsvg怎么转jpg

本文操作环境:windows7系统、php7.1版、DELL G3电脑

php svg怎么转svg?

php imagick svg转成jpg

代码如下:

public function svgtojpg()
{
$image = '




';
$filename = 'ef.jpg';
/* $image = stripslashes($_POST['json']);
$filename = $_POST['filename'];*/
$unique = time();
$im = new \Imagick();
$im->readImageBlob($image);
$res = $im->getImageResolution();
$x_ratio = $res['x'] / $im->getImageWidth();
$y_ratio = $res['y'] / $im->getImageHeight();
$im->removeImage();
$im->setResolution($width_in_pixels * $x_ratio, $height_in_pixels * $y_ratio);
$im->readImageBlob($image);
$im->setImageFormat("jpeg");
$im->writeImage(__DIR__ . '/../../../Public/moban/images/1/humourised_'. $filename);
$im->clear();
$im->destroy();
}

文章题目:phpsvg怎么转jpg
URL标题:http://cdysf.com/article/dhceshj.html