Skip to content

Calculate bounding box for SVG path in PHP

Notifications You must be signed in to change notification settings

smirkos/svg-bounds

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

SVG Bounds in PHP

Calculate smallest bounding rectangle for given SVG path strings and points.

Only handles paths composed of straight lines. Bezier and arc commands throw an exception.

Example usage:

 $bounds = SvgBounds::fromPath('M 100 100L300 100 200 300z');
 echo $bounds->getWidth(); //200
 $bounds->extend(350, 100);
 echo $bounds->getWidth(); //250

License: Public domain

About

Calculate bounding box for SVG path in PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%