Skip to content

Commit

Permalink
Merge e7ac75d into a3e94f7
Browse files Browse the repository at this point in the history
  • Loading branch information
tobz-nz committed Dec 18, 2019
2 parents a3e94f7 + e7ac75d commit ac338ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Avatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public function toSvg()
$radius = ($this->width - $this->borderSize) / 2;
$center = $this->width / 2;

$svg = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="'.$this->width.'" height="'.$this->height.'">';
$svg = '<svg width="'.$this->width.'" height="'.$this->height.'" viewBox="0 0 '.$this->width.' '.$this->height.'">';

if ($this->shape == 'square') {
$svg .= '<rect x="'.$x
Expand Down
6 changes: 3 additions & 3 deletions tests/AvatarPhpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function it_can_generate_file()
*/
public function it_can_generate_circle_svg()
{
$expected = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="100" height="100">';
$expected = '<svg width="100" height="100" viewBox="0 0 100 100">';
$expected .= '<circle cx="50" cy="50" r="45" stroke="yellow" stroke-width="10" fill="red" />';
$expected .= '<text x="50" y="50" font-size="24" fill="white" alignment-baseline="middle" text-anchor="middle" dominant-baseline="central">AB</text>';
$expected .= '</svg>';
Expand All @@ -197,7 +197,7 @@ public function it_can_generate_circle_svg()
*/
public function it_can_generate_rectangle_svg()
{
$expected = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="100" height="100">';
$expected = '<svg width="100" height="100" viewBox="0 0 100 100">';
$expected .= '<rect x="5" y="5" width="90" height="90" stroke="yellow" stroke-width="10" fill="red" />';
$expected .= '<text x="50" y="50" font-size="24" fill="white" alignment-baseline="middle" text-anchor="middle" dominant-baseline="central">AB</text>';
$expected .= '</svg>';
Expand All @@ -220,7 +220,7 @@ public function it_can_generate_rectangle_svg()
*/
public function it_can_generate_svg_with_custom_font_family()
{
$expected = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="100" height="100">';
$expected = '<svg width="100" height="100" viewBox="0 0 100 100">';
$expected .= '<circle cx="50" cy="50" r="45" stroke="yellow" stroke-width="10" fill="red" />';
$expected .= '<text x="50" y="50" font-size="24" font-family="Lato" fill="white" alignment-baseline="middle" text-anchor="middle" dominant-baseline="central">AB</text>';
$expected .= '</svg>';
Expand Down

0 comments on commit ac338ba

Please sign in to comment.