feat(blog): custom hero, OG and blog card images for articles#425
Merged
Conversation
…rop tools Articles can now have a hero image uploaded in the admin. From one upload, three derivatives are generated with admin-adjustable crop selections: - OG image (1200x630, replaces TheOG-generated image while present) - blog card preview (1200x450, shown atop /blog cards) - article header (2048x1000, shown atop the article at up to 500px tall) Includes a dependency-free Filament ImageCropper field (Alpine), an ArticleImageService for scaling/cropping via Intervention Image, file lifecycle cleanup on replace/slug change/delete, stacked form labels, and the admin 'Articles' section renamed to 'Blog'. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Articles can now have a custom hero image uploaded in the admin. From that single upload, three derivatives are generated, each with its own admin-adjustable crop:
og-images/{slug}.pngpath, so it replaces the TheOG-generated image inog:image/Twitter meta while a hero exists. Remove the hero and the article reverts to TheOG generation./blogcards (≤200px tall, clipped by the card's rounded corners).Also renames the admin Articles section to Blog (nav label, breadcrumb, list title — no class renames) and stacks the article form labels instead of inline.
How
ImageCropperFilament field (app/Filament/Forms/Components/ImageCropper.php+ blade): a dependency-free Alpine crop tool — aspect-locked drag/resize selection box storing{x, y, width, height}rects as JSON. Crops are non-destructive and re-adjustable at any time without re-uploading. The Croppie plugin was considered but it requires Filament ^3.2 (this app is on v5) and only supports destructive upload-time crops, one file per field.ArticleImageService: scales oversized heroes down in place (max 2400px wide), generates the three crops via Intervention Image (already a direct dependency), clamps/centers invalid or missing crop rects, and handles file cleanup when the hero is replaced, the slug changes, the hero is removed, or the article is deleted.Testing
memory_limit> 128M (peaks ~259MB) — this is pre-existing (confirmed on a cleanmainworktree), Herd's default CLI limit fails partway through the suite either way.og:imagerendering, and deletion cleanup.🤖 Generated with Claude Code