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

Projects
None yet
2 participants
@westonruter
Copy link
Member

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

@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 May 16, 2018

@westonruter westonruter force-pushed the add/svg-image-dimension-extraction branch 4 times, most recently from f12ef62 to e4c073b May 17, 2018

@westonruter westonruter force-pushed the add/svg-image-dimension-extraction branch from e4c073b to 4ef7950 May 17, 2018

@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;

This comment has been minimized.

Copy link
@amedina

amedina May 17, 2018

Member

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

@amedina
Copy link
Member

amedina left a comment

This is pretty good; ship it!

@westonruter westonruter merged commit adc8fed into develop May 18, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@westonruter westonruter deleted the add/svg-image-dimension-extraction branch May 18, 2018

@westonruter westonruter referenced this pull request Mar 6, 2019

Merged

Add support for parsing dimensions from SVG images #14

2 of 2 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.