-
Notifications
You must be signed in to change notification settings - Fork 3
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
Added Twig Filter to get the average color of an Image. Used in Email… #127
base: develop
Are you sure you want to change the base?
Conversation
return sprintf("#%02x%02x%02x", $rgb["red"], $rgb["green"], $rgb["blue"]); | ||
} | ||
|
||
private function createImageFromFile(string $imagePath): \GdImage|false { |
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.
use
statement for GdImage
maybe use null
instead of false for "no image"
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.
false is returned from imagecreatefrom*** if an error happened. So false to be complient with that.
@@ -1,7 +1,7 @@ | |||
{# TODO embedd logo to make it independent of changes #} | |||
<div class="head-wrap bg-primary" | |||
{% if settings.get('style.bg_image') is not empty %} | |||
style="background-image: url({{ absolute_url(settings.get('style.bg_image')) }})" | |||
style="background-image: url({{ absolute_url(settings.get('style.bg_image')) }}); background-color: {{ absolute_url(settings.get('style.bg_image')) | average_color }}" |
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.
no absolute_url here, as this is the parameter for average_color. Use the file path instead.
Added Twig Filter to get the average color of an Image. Used in Email as bg-color