$f = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'.$res['svgXml'];
$im = new \Imagick();
$im->readImageBlob($f);
$im->setImageFormat("png");
$srcImage = $im->getImageGeometry(); //获取源图片宽和高
$im->resizeImage($srcImage['width'], $srcImage['height'], \imagick::FILTER_LANCZOS, 1, false);
$fileName = '/tmp/venue_svg_'.time().'_'.$venue_id.'.png';
$im->writeImage($fileName);
$im->clear();
$post = [
'name' => $name,
'base64_str' => 'data:image/jpg/png/gif;base64,'. base64_encode(file_get_contents('/home/zhangcunchao/webroot/em-piao/public/img/1.png')),
];
$image = app(SharedService::class)->uploadImageBase64($post);
本文档使用 521Wiki 发布