Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for extracting (pixel) dimensions from SVG images #1150

Merged
merged 4 commits into from
May 18, 2018

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented May 16, 2018

When there are img tags that reference SVG images and the img does not include the width or height in HTML, we need to obtain the dimensions of the underlying SVG image in its own width and height attributes in a similar way to how we extract dimensions from raster image formats like PNG and JPEG.

  • Extract width/height from viewBox if width or height attributes aren't pixel values.

@westonruter westonruter added this to the v1.0 milestone May 16, 2018
@westonruter westonruter requested a review from amedina May 16, 2018 15:41
@westonruter westonruter changed the title Add support for extracting (pixel) dimensions from SVG images [WIP] Add support for extracting (pixel) dimensions from SVG images May 16, 2018
@westonruter westonruter force-pushed the add/svg-image-dimension-extraction branch 21 times, most recently from b105a25 to 795d88e Compare May 17, 2018 00:15
@westonruter westonruter force-pushed the add/svg-image-dimension-extraction branch 4 times, most recently from f12ef62 to e4c073b Compare May 17, 2018 01:31
@westonruter westonruter force-pushed the add/svg-image-dimension-extraction branch from e4c073b to 4ef7950 Compare May 17, 2018 01:39
@westonruter westonruter changed the title [WIP] Add support for extracting (pixel) dimensions from SVG images Add support for extracting (pixel) dimensions from SVG images May 17, 2018
@@ -70,7 +70,14 @@ public function getType()
case chr(0x89).'P':
return $this->type = 'png';
default:
return false;
$this->strpos = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a clarifying question: why can't the SVG part be on its own 'case' branch rather than on the 'default' one?

Copy link
Member

@amedina amedina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty good; ship it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants