1--TEST--
2Test Tutorial, svgExample
3--SKIPIF--
4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
5--FILE--
6<?php
7
8
9function svgExample() {
10
11    $svg = <<< END
12<?xml version="1.0"?>
13<svg version='1.0' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='746' height='742' viewBox='-362 -388 746 742' encoding='UTF-8' standalone='no'>
14    <defs>
15        <ellipse id='ellipse' cx='36' cy='-56' rx='160' ry='320' />
16        <g id='ellipses'>
17            <use xlink:href='#ellipse' fill='#0000ff' />
18            <use xlink:href='#ellipse' fill='#0099ff' transform='rotate(72)' />
19        </g>
20    </defs>
21</svg>
22END;
23
24
25
26    $svg = '<?xml version="1.0"?>
27    <svg width="120" height="120"
28         viewPort="0 0 120 120" version="1.1"
29         xmlns="http://www.w3.org/2000/svg">
30
31        <defs>
32            <clipPath id="myClip">
33                <circle cx="30" cy="30" r="20"/>
34                <circle cx="70" cy="70" r="20"/>
35            </clipPath>
36        </defs>
37
38        <rect x="10" y="10" width="100" height="100"
39              clip-path="url(#myClip)"/>
40
41    </svg>';
42
43
44
45
46    $image = new \Imagick();
47
48    $image->readImageBlob($svg);
49    $image->setImageFormat("jpg");
50    $bytes = $image;
51    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
52}
53
54svgExample() ;
55echo "Ok";
56?>
57--EXPECTF--
58Ok