-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support for intervention/image:^3.4.0 #33
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevindierkx this looks great but the tests are failing... I think you'll need to refresh the snapshots and commit those changes
@simonhamp I've update the snapshots. The placement of the first two using the avatar seems a little off:
The other snapshots word-wrap a little differently now when using the intevention wrapping logic, which would be expected. I'll try to review those avatar layouts next week. |
@kevindierkx and this one also has something up with the background repeating where it didn't repeat before |
This PR's primary focus is to support
intervention/image:^3.4.0
, it comes with some breaking changes however.Text wrapping
Wrapping of long sentences is now handled by
intervention/image
directly, truncating and the removal of lines of text that wouldn't fit in the containing 'box' is handled bythe-og
.This heavily relies on the
FontProcessor
implementation of the used driver, eg. Imagick or Gd. Since we need to calculate the dimensions of aTextBox
, to correctly calculate the 'anchor' point/position of related items, the 'canvas' ie. theImageInterface
has been moved from the feature'srender
method to an earlier stage using the addedsetCanvas()
method. This is currently placed in theaddFeature()
method, called during therender
cycle of the layout.This modifies the signature of the
render()
method and will therefore break custom "Features".Addition of the
dimensions()
methodThe
dimensions()
method essentially replaces thegetPrerenderedBox()
andgetRenderedBox()
methods. The latter were primarily used to calculate anchors and line lengths. Unless a custom "Feature" would call these directly this shouldn't be as impactful.Removal of the
TextModifier
implementationThis class was added at some point to calculate the bounding box of a text block. Since this is now directly handled in either the
dimenstions()
method or theTextBox
implementation this class is now obsolete.Driver agnostic improvements
Because we now directly interact with the image instance for various operations that would require a driver we don't need to initialise drivers or driver related instances ourself. Except for the
PictureBox
everything should now also work with GD, not sure if anyone was waiting for GD support... but hey it's there.CTA placement fixes
Some default layouts were missing the preferred position, these have been added and the CTA element is now correctly displayed for all layouts.
Example output
Using the example from the docs, the image below is now the resulting output.