Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

feat(tweet-card): tabler verified badge (svg source committed) + badge placement next to name

Paulo Castellano9f7b7976741f
diff --git a/app/Services/Image/TemplateImageGenerator.php b/app/Services/Image/TemplateImageGenerator.php
index a4be6670f..92915295b 100644
--- a/app/Services/Image/TemplateImageGenerator.php
+++ b/app/Services/Image/TemplateImageGenerator.php
@@ -625,23 +625,21 @@ class TemplateImageGenerator
$nameX = $avatarX + $avatarSize + 16;
$nameY = $avatarY + 4;
- if ($fontBold) {
- $canvas->text($socialAccount->display_name ?? '', $nameX, $nameY, function (FontFactory $font) use ($fontBold, $nameSize) {
- $font->filename($fontBold);
- $font->size($nameSize);
- $font->color('#0f1419');
- $font->align('left', 'top');
- });
+ $displayNameText = $socialAccount->display_name ?? '';
+ $nameBox = $fontBold ? imagettfbbox($nameSize, 0, $fontBold, $displayNameText) : [0, 0, 0, 0, 0, 0, 0, 0];
+ $nameWidth = abs($nameBox[2] - $nameBox[0]);
+ $nameAscent = (int) round(abs($nameBox[7]));
+ $nameBaselineY = $nameY + $nameAscent;
+
+ if ($fontBold && $displayNameText !== '') {
+ $this->drawTextAt($core, $displayNameText, $fontBold, $nameSize, '#0f1419', $nameX, $nameBaselineY);
}
$verifiedPath = public_path('images/ai-templates/verified.png');
- if ($fontBold && file_exists($verifiedPath)) {
- $displayNameText = $socialAccount->display_name ?? '';
- $nameBox = $fontBold ? imagettfbbox($nameSize, 0, $fontBold, $displayNameText) : [0, 0, 0, 0, 0, 0, 0, 0];
- $nameWidth = abs($nameBox[2] - $nameBox[0]);
- $badgeSize = (int) round($nameSize * 1.1);
- $badgeX = $nameX + $nameWidth + 6;
- $badgeY = $nameY + (int) round(($nameSize - $badgeSize) / 2);
+ if ($fontBold && $displayNameText !== '' && file_exists($verifiedPath)) {
+ $badgeSize = (int) round($nameSize * 1.15);
+ $badgeX = $nameX + $nameWidth + 8;
+ $badgeY = $nameY + (int) round(($nameAscent - $badgeSize) / 2);
$verifiedSrc = @imagecreatefrompng($verifiedPath);
if ($verifiedSrc) {
$verifiedResized = imagecreatetruecolor($badgeSize, $badgeSize);
@@ -657,14 +655,12 @@ class TemplateImageGenerator
}
}
- $handleY = $nameY + (int) round($nameSize * 1.35);
- if ($fontLight) {
- $canvas->text('@'.($socialAccount->username ?? ''), $nameX, $handleY, function (FontFactory $font) use ($fontLight, $handleSize) {
- $font->filename($fontLight);
- $font->size($handleSize);
- $font->color('#536471');
- $font->align('left', 'top');
- });
+ $handleText = '@'.($socialAccount->username ?? '');
+ $handleBox = $fontLight ? imagettfbbox($handleSize, 0, $fontLight, $handleText) : [0, 0, 0, 0, 0, 0, 0, 0];
+ $handleAscent = (int) round(abs($handleBox[7]));
+ $handleY = $nameY + (int) round($nameSize * 1.4);
+ if ($fontLight && $socialAccount->username) {
+ $this->drawTextAt($core, $handleText, $fontLight, $handleSize, '#536471', $nameX, $handleY + $handleAscent);
}
$bodyStartY = $cardY + $headerH + 8;
diff --git a/public/images/ai-templates/verified.png b/public/images/ai-templates/verified.png
index 2482d7138..3220b379f 100644
Binary files a/public/images/ai-templates/verified.png and b/public/images/ai-templates/verified.png differ
diff --git a/public/images/ai-templates/verified.svg b/public/images/ai-templates/verified.svg
new file mode 100644
index 000000000..7d63fe7b8
--- /dev/null
+++ b/public/images/ai-templates/verified.svg
@@ -0,0 +1,11 @@
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="#1D9BF0"
+ class="icon icon-tabler icons-tabler-filled icon-tabler-rosette-discount-check"
+>
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
+ <path d="M12.01 2.011a3.2 3.2 0 0 1 2.113 .797l.154 .145l.698 .698a1.2 1.2 0 0 0 .71 .341l.135 .008h1a3.2 3.2 0 0 1 3.195 3.018l.005 .182v1c0 .27 .092 .533 .258 .743l.09 .1l.697 .698a3.2 3.2 0 0 1 .147 4.382l-.145 .154l-.698 .698a1.2 1.2 0 0 0 -.341 .71l-.008 .135v1a3.2 3.2 0 0 1 -3.018 3.195l-.182 .005h-1a1.2 1.2 0 0 0 -.743 .258l-.1 .09l-.698 .697a3.2 3.2 0 0 1 -4.382 .147l-.154 -.145l-.698 -.698a1.2 1.2 0 0 0 -.71 -.341l-.135 -.008h-1a3.2 3.2 0 0 1 -3.195 -3.018l-.005 -.182v-1a1.2 1.2 0 0 0 -.258 -.743l-.09 -.1l-.697 -.698a3.2 3.2 0 0 1 -.147 -4.382l.145 -.154l.698 -.698a1.2 1.2 0 0 0 .341 -.71l.008 -.135v-1l.005 -.182a3.2 3.2 0 0 1 3.013 -3.013l.182 -.005h1a1.2 1.2 0 0 0 .743 -.258l.1 -.09l.698 -.697a3.2 3.2 0 0 1 2.269 -.944zm3.697 7.282a1 1 0 0 0 -1.414 0l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.32 1.497l2 2l.094 .083a1 1 0 0 0 1.32 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z" />
+</svg>
\ No newline at end of file