🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Add image resizer tool and enhance related tools section
Bill Yange7174e795543
diff --git a/docs/package-lock.json b/docs/package-lock.jsonindex a3566520f..5079c9aa4 100644--- a/docs/package-lock.json+++ b/docs/package-lock.json@@ -27,6 +27,7 @@"next-themes": "^0.4.6","react": "^19.2.0","react-dom": "^19.2.0",+ "react-easy-crop": "^5.5.5","react-tweet": "^3.2.2","tailwind-merge": "^3.3.1","zod": "^4.1.12"@@ -9588,6 +9589,12 @@"dev": true,"license": "MIT"},+ "node_modules/normalize-wheel": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz",+ "integrity": "sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA==",+ "license": "BSD-3-Clause"+ },"node_modules/npm-to-yarn": {"version": "3.0.1","resolved": "https://registry.npmjs.org/npm-to-yarn/-/npm-to-yarn-3.0.1.tgz",@@ -10098,6 +10105,20 @@"react": "^19.2.0"}},+ "node_modules/react-easy-crop": {+ "version": "5.5.5",+ "resolved": "https://registry.npmjs.org/react-easy-crop/-/react-easy-crop-5.5.5.tgz",+ "integrity": "sha512-aRiY8CnsHir4cmoPaXbZW0Hpmy0Wd+7mxZbALx/+rxvAIIy0hesK48hCBjorAt9Kl9dA8IskWnhOq3ky44coLA==",+ "license": "MIT",+ "dependencies": {+ "normalize-wheel": "^1.0.1",+ "tslib": "^2.0.1"+ },+ "peerDependencies": {+ "react": ">=16.4.0",+ "react-dom": ">=16.4.0"+ }+ },"node_modules/react-is": {"version": "16.13.1","resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",diff --git a/docs/package.json b/docs/package.jsonindex 6e16578c6..e1249b609 100644--- a/docs/package.json+++ b/docs/package.json@@ -27,6 +27,7 @@"next-themes": "^0.4.6","react": "^19.2.0","react-dom": "^19.2.0",+ "react-easy-crop": "^5.5.5","react-tweet": "^3.2.2","tailwind-merge": "^3.3.1","zod": "^4.1.12"diff --git a/docs/src/app/(home)/tools/(font-generators)/[slug]/page.tsx b/docs/src/app/(home)/tools/(font-generators)/[slug]/page.tsxindex 5137348e5..11f396256 100644--- a/docs/src/app/(home)/tools/(font-generators)/[slug]/page.tsx+++ b/docs/src/app/(home)/tools/(font-generators)/[slug]/page.tsx@@ -4,18 +4,13 @@ import AICommentForm from "../../components/AICommentForm";import PageNameGenerator from "../../components/PageNameGenerator";import PostGenerator from "../../components/PostGenerator";import UsernameGenerator from "../../components/UsernameGenerator";+import ImageResizer from "../../components/ImageResizer";import { HashtagGenerator } from "../../components/HashtagGenerator";import { CharacterCounter } from "../../components/CharacterCounter";import { BioGenerator } from "../../components/BioGenerator";import { platformConfigs, platformList } from "../../components/platform-configs";-import {- commentPlatformConfigs,- commentPlatformList,-} from "../../components/comment-platform-configs";-import {- pageNamePlatformConfigs,- pageNamePlatformList,-} from "../../components/page-name-platform-configs";+import { commentPlatformConfigs, commentPlatformList } from "../../components/comment-platform-configs";+import { pageNamePlatformConfigs, pageNamePlatformList } from "../../components/page-name-platform-configs";import {postGeneratorPlatformConfigs,postGeneratorPlatformList,@@ -32,10 +27,8 @@ import {characterCounterPlatformConfigs,characterCounterPlatformList,} from "../../components/character-counter-platform-configs";-import {- bioGeneratorPlatformConfigs,- bioGeneratorPlatformList,-} from "../../components/bio-generator-platform-configs";+import { bioGeneratorPlatformConfigs, bioGeneratorPlatformList } from "../../components/bio-generator-platform-configs";+import { imageResizerPlatformConfigs, imageResizerPlatformList } from "../../components/image-resizer-platform-configs";import type { Metadata } from "next";import { notFound } from "next/navigation";@@ -47,38 +40,42 @@ interface PageProps {// Generate static params for all platforms at build timeexport async function generateStaticParams() {- const fontGenerators = platformList.map((platform) => ({+ const fontGenerators = platformList.map(platform => ({slug: `${platform.id}-font-generator`,}));- const commentGenerators = commentPlatformList.map((platform) => ({+ const commentGenerators = commentPlatformList.map(platform => ({slug: `${platform.id}-comment-generator`,}));- const pageNameGenerators = pageNamePlatformList.map((platform) => ({+ const pageNameGenerators = pageNamePlatformList.map(platform => ({slug: `${platform.id}-page-name-generator`,}));- const postGenerators = postGeneratorPlatformList.map((platform) => ({+ const postGenerators = postGeneratorPlatformList.map(platform => ({slug: `${platform.id}-post-generator`,}));- const usernameGenerators = usernameGeneratorPlatformList.map((platform) => ({+ const usernameGenerators = usernameGeneratorPlatformList.map(platform => ({slug: `${platform.id}-username-generator`,}));- const hashtagGenerators = hashtagGeneratorPlatformList.map((platform) => ({+ const hashtagGenerators = hashtagGeneratorPlatformList.map(platform => ({slug: `${platform.id}-hashtag-generator`,}));- const characterCounters = characterCounterPlatformList.map((platform) => ({+ const characterCounters = characterCounterPlatformList.map(platform => ({slug: `${platform.id}-character-counter`,}));- const bioGenerators = bioGeneratorPlatformList.map((platform) => ({+ const bioGenerators = bioGeneratorPlatformList.map(platform => ({slug: `${platform.id}-bio-generator`,}));+ const imageResizers = imageResizerPlatformList.map(platform => ({+ slug: `${platform.id}-photo-resizer`,+ }));+return [...fontGenerators,...commentGenerators,@@ -88,15 +85,44 @@ export async function generateStaticParams() {...hashtagGenerators,...characterCounters,...bioGenerators,+ ...imageResizers,];}// Generate metadata dynamically based on slug-export async function generateMetadata({- params,-}: PageProps): Promise<Metadata> {+export async function generateMetadata({ params }: PageProps): Promise<Metadata> {const { slug } = await params;+ // Check if it's an image resizer+ if (slug.endsWith("-photo-resizer")) {+ const platformId = slug.replace("-photo-resizer", "");+ const platform = imageResizerPlatformConfigs[platformId];++ if (!platform) {+ return { title: "Photo Resizer Not Found" };+ }++ return {+ title: `${platform.displayName} | Free Online Image Cropper`,+ description: platform.description,+ openGraph: {+ title: platform.displayName,+ description: platform.description,+ type: "website",+ url: `https://rybbit.com/tools/${platform.id}-photo-resizer`,+ siteName: "Rybbit Documentation",+ },+ twitter: {+ card: "summary_large_image",+ title: platform.displayName,+ description: platform.description,+ },+ alternates: {+ canonical: `https://rybbit.com/tools/${platform.id}-photo-resizer`,+ },+ };+ }+// Check if it's a bio generatorif (slug.endsWith("-bio-generator")) {const platformId = slug.replace("-bio-generator", "");@@ -341,6 +367,111 @@ export async function generateMetadata({export default async function PlatformToolPage({ params }: PageProps) {const { slug } = await params;+ // Check if it's an image resizer+ if (slug.endsWith("-photo-resizer")) {+ const platformId = slug.replace("-photo-resizer", "");+ const platform = imageResizerPlatformConfigs[platformId];++ if (!platform) {+ notFound();+ }++ const structuredData = {+ "@context": "https://schema.org",+ "@type": "WebApplication",+ name: platform.displayName,+ description: platform.description,+ url: `https://rybbit.com/tools/${platform.id}-photo-resizer`,+ applicationCategory: "MultimediaApplication",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ author: {+ "@type": "Organization",+ name: "Rybbit",+ url: "https://rybbit.com",+ },+ };++ const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">About {platform.name} Image Sizes</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">{platform.educationalContent}</p>++ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">How to Use This Tool</h3>+ <ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Upload your image</strong> - Drag and drop or click to select+ </li>+ <li>+ <strong>Select the format</strong> - Choose from {platform.dimensions.length} presets (Profile, Cover, Post,+ etc.)+ </li>+ <li>+ <strong>Adjust the crop</strong> - Zoom, rotate, and position your image+ </li>+ <li>+ <strong>Download</strong> - Get your perfectly sized image instantly+ </li>+ </ol>++ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">+ Standard {platform.name} Dimensions+ </h3>+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4 mb-6">+ {platform.dimensions.map(dim => (+ <div+ key={dim.label}+ className="p-4 bg-neutral-50 dark:bg-neutral-900/20 rounded-lg border border-neutral-200 dark:border-neutral-800"+ >+ <div className="font-semibold text-neutral-900 dark:text-white">{dim.label}</div>+ <div className="text-emerald-600 dark:text-emerald-400 font-mono text-sm">+ {dim.width} x {dim.height} px+ </div>+ {dim.description && <div className="text-xs text-neutral-500 mt-1">{dim.description}</div>}+ </div>+ ))}+ </div>+ </>+ );++ const faqs = [+ {+ question: `What are the best image sizes for ${platform.name}?`,+ answer: `${platform.name} recommends different sizes for different placements. For example, profile pictures should be ${platform.dimensions[0].width}x${platform.dimensions[0].height}px. This tool includes all the standard dimensions to ensure your images look crisp.`,+ },+ {+ question: "Does this tool compress my images?",+ answer:+ "This tool resizes and crops your images to the exact dimensions required by the platform. It maintains high quality while ensuring the file size is optimized for web upload.",+ },+ {+ question: "Is my image uploaded to a server?",+ answer:+ "No! All processing happens locally in your browser. Your images never leave your device, ensuring complete privacy and security.",+ },+ ];++ return (+ <ToolPageLayout+ toolSlug={`${platform.id}-photo-resizer`}+ title={platform.displayName}+ description={platform.description}+ badge="Free Tool"+ toolComponent={<ImageResizer platform={platform} />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="social-media"+ ctaTitle={`Enhance your ${platform.name} visuals with Rybbit`}+ ctaDescription="Track engagement on your perfectly sized images."+ ctaEventLocation={`${platform.id}_photo_resizer_cta`}+ structuredData={structuredData}+ />+ );+ }+// Check if it's a bio generatorif (slug.endsWith("-bio-generator")) {const platformId = slug.replace("-bio-generator", "");@@ -375,44 +506,33 @@ export default async function PlatformToolPage({ params }: PageProps) {<h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">About {platform.name} {platform.bioType}s</h2>- <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">- {platform.educationalContent}- </p>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">{platform.educationalContent}</p>- <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">- How to Use This Tool- </h3>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">How to Use This Tool</h3><ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li>- <strong>Enter your name or brand</strong> - What should the bio be- about?+ <strong>Enter your name or brand</strong> - What should the bio be about?</li><li><strong>Add your profession or role</strong> - What do you do?</li><li>- <strong>Include interests (optional)</strong> - What are you- passionate about?+ <strong>Include interests (optional)</strong> - What are you passionate about?</li><li>- <strong>Select your tone</strong> - Choose from{" "}- {platform.tones.length} tone options+ <strong>Select your tone</strong> - Choose from {platform.tones.length} tone options</li><li>- <strong>Click "Generate {platform.bioType}"</strong> to get 3- unique variations+ <strong>Click "Generate {platform.bioType}"</strong> to get 3 unique variations</li><li>- <strong>Copy and customize</strong> your favorite bio for{" "}- {platform.name}+ <strong>Copy and customize</strong> your favorite bio for {platform.name}</li></ol>- <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">- Available Tones- </h3>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">Available Tones</h3><ul className="grid grid-cols-2 gap-2 text-sm text-neutral-700 dark:text-neutral-300 mb-6">- {platform.tones.map((tone) => (+ {platform.tones.map(tone => (<li key={tone} className="flex items-center gap-2"><span className="w-1.5 h-1.5 rounded-full bg-emerald-500" />{tone}@@ -428,41 +548,33 @@ export default async function PlatformToolPage({ params }: PageProps) {<strong>Be authentic:</strong> Let your personality shine through</li><li>- <strong>Front-load important info:</strong> Put key information at- the beginning+ <strong>Front-load important info:</strong> Put key information at the beginning</li><li>- <strong>Include a call-to-action:</strong> Tell people what to do- next+ <strong>Include a call-to-action:</strong> Tell people what to do next</li><li>- <strong>Use keywords:</strong> Include relevant terms for- discoverability+ <strong>Use keywords:</strong> Include relevant terms for discoverability</li><li>- <strong>Stay within the limit:</strong> Keep it under{" "}- {platform.characterLimit} characters+ <strong>Stay within the limit:</strong> Keep it under {platform.characterLimit} characters</li><li>- <strong>Update regularly:</strong> Keep your bio current with your- focus+ <strong>Update regularly:</strong> Keep your bio current with your focus</li></ul><div className="bg-emerald-50 dark:bg-emerald-900/20 border border-emerald-200 dark:border-emerald-800 rounded-lg p-4 mb-6">- <h4 className="font-semibold text-emerald-900 dark:text-emerald-100 mb-2">- Character Limit- </h4>+ <h4 className="font-semibold text-emerald-900 dark:text-emerald-100 mb-2">Character Limit</h4><p className="text-sm text-emerald-800 dark:text-emerald-200">- {platform.name} {platform.bioType}s have a maximum of{" "}- {platform.characterLimit} characters. Make every character count!+ {platform.name} {platform.bioType}s have a maximum of {platform.characterLimit} characters. Make every+ character count!</p></div><p className="text-sm text-neutral-600 dark:text-neutral-400 mt-6">- <strong>Note:</strong> While this tool generates high-quality bios,- always personalize them to match your authentic voice and current- focus. The best bios are genuine and reflect who you really are.+ <strong>Note:</strong> While this tool generates high-quality bios, always personalize them to match your+ authentic voice and current focus. The best bios are genuine and reflect who you really are.</p></>);@@ -474,7 +586,11 @@ export default async function PlatformToolPage({ params }: PageProps) {},{question: "What tones are available?",- answer: `You can choose from ${platform.tones.length} tones: ${platform.tones.join(", ")}. Each tone is optimized for ${platform.name} and creates a different impression to match your personal brand.`,+ answer: `You can choose from ${platform.tones.length} tones: ${platform.tones.join(+ ", "+ )}. Each tone is optimized for ${+ platform.name+ } and creates a different impression to match your personal brand.`,},{question: "Should I edit the generated bios?",@@ -494,13 +610,9 @@ export default async function PlatformToolPage({ params }: PageProps) {question: "How can Rybbit help me grow on social media?",answer: (<>- Once you have a great bio, Rybbit helps you track engagement,- clicks, and growth on {platform.name}. Understand what content- resonates with your audience and optimize your strategy.{" "}- <a- href="https://rybbit.com"- className="text-emerald-600 hover:text-emerald-500 underline"- >+ Once you have a great bio, Rybbit helps you track engagement, clicks, and growth on {platform.name}.+ Understand what content resonates with your audience and optimize your strategy.{" "}+ <a href="https://rybbit.com" className="text-emerald-600 hover:text-emerald-500 underline">Start tracking for free</a>.@@ -561,13 +673,9 @@ export default async function PlatformToolPage({ params }: PageProps) {<h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">About {platform.name} Character Limits</h2>- <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">- {platform.educationalContent}- </p>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">{platform.educationalContent}</p>- <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">- How to Use This Tool- </h3>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">How to Use This Tool</h3><ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li><strong>Type or paste your text</strong> into the text area above@@ -576,52 +684,42 @@ export default async function PlatformToolPage({ params }: PageProps) {<strong>Watch the character count</strong> update in real-time</li><li>- <strong>Monitor the progress bar</strong> to see how close you are- to the limit+ <strong>Monitor the progress bar</strong> to see how close you are to the limit</li><li><strong>Adjust your text</strong> to stay within {platform.name}'s{" "}{platform.characterLimit.toLocaleString()}-character limit</li><li>- <strong>Copy your optimized text</strong> and paste it into{" "}- {platform.name}+ <strong>Copy your optimized text</strong> and paste it into {platform.name}</li></ol>- <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">- Understanding the Counter- </h3>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">Understanding the Counter</h3><ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li>- <strong>Character Count:</strong> Total number of characters- including spaces and punctuation+ <strong>Character Count:</strong> Total number of characters including spaces and punctuation</li><li>- <strong>Without Spaces:</strong> Character count excluding all- whitespace+ <strong>Without Spaces:</strong> Character count excluding all whitespace</li><li>- <strong>Remaining:</strong> How many more characters you can add- before hitting the limit+ <strong>Remaining:</strong> How many more characters you can add before hitting the limit</li><li>- <strong>Progress Bar:</strong> Visual indicator of how much of the- limit you've used+ <strong>Progress Bar:</strong> Visual indicator of how much of the limit you've used</li>{platform.recommendedLimit && (<li>- <strong>Recommended Limit:</strong> {platform.name} allows{" "}- {platform.characterLimit.toLocaleString()} characters, but posts- under {platform.recommendedLimit} characters often perform better+ <strong>Recommended Limit:</strong> {platform.name} allows {platform.characterLimit.toLocaleString()}{" "}+ characters, but posts under {platform.recommendedLimit} characters often perform better</li>)}</ul><p className="text-sm text-neutral-600 dark:text-neutral-400 mt-6">- <strong>Note:</strong> This tool counts characters locally in your- browser. Your text is never sent to any server, ensuring complete- privacy.+ <strong>Note:</strong> This tool counts characters locally in your browser. Your text is never sent to any+ server, ensuring complete privacy.</p></>);@@ -661,13 +759,9 @@ export default async function PlatformToolPage({ params }: PageProps) {question: "How can Rybbit help me track my social media performance?",answer: (<>- Rybbit helps you track engagement, clicks, and performance of your{" "}- {platform.name} posts. See which content resonates with your- audience and optimize your strategy.{" "}- <a- href="https://rybbit.com"- className="text-emerald-600 hover:text-emerald-500 underline"- >+ Rybbit helps you track engagement, clicks, and performance of your {platform.name} posts. See which content+ resonates with your audience and optimize your strategy.{" "}+ <a href="https://rybbit.com" className="text-emerald-600 hover:text-emerald-500 underline">Start tracking for free</a>.@@ -725,42 +819,32 @@ export default async function PlatformToolPage({ params }: PageProps) {const educationalContent = (<>- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">- About {platform.name} Hashtags- </h2>- <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">- {platform.educationalContent}- </p>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">About {platform.name} Hashtags</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">{platform.educationalContent}</p>- <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">- How to Use This Tool- </h3>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">How to Use This Tool</h3><ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li><strong>Describe your content</strong> - What is your post about?</li><li>- <strong>Select a strategy</strong> - Choose from{" "}- {platform.hashtagStrategies.length} platform-optimized strategies+ <strong>Select a strategy</strong> - Choose from {platform.hashtagStrategies.length} platform-optimized+ strategies</li><li>- <strong>Add niche keywords (optional)</strong> - Include specific- topics or interests+ <strong>Add niche keywords (optional)</strong> - Include specific topics or interests</li><li><strong>Click "Generate Hashtags"</strong> to get 3 unique sets</li><li>- <strong>Copy and use</strong> your favorite hashtag set on{" "}- {platform.name}+ <strong>Copy and use</strong> your favorite hashtag set on {platform.name}</li></ol>- <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">- Available Hashtag Strategies- </h3>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">Available Hashtag Strategies</h3><ul className="grid grid-cols-2 gap-2 text-sm text-neutral-700 dark:text-neutral-300 mb-6">- {platform.hashtagStrategies.map((strategy) => (+ {platform.hashtagStrategies.map(strategy => (<li key={strategy} className="flex items-center gap-2"><span className="w-1.5 h-1.5 rounded-full bg-emerald-500" />{strategy}@@ -773,40 +857,32 @@ export default async function PlatformToolPage({ params }: PageProps) {</h3><ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li>- <strong>Use relevant hashtags:</strong> Choose hashtags that- accurately describe your content+ <strong>Use relevant hashtags:</strong> Choose hashtags that accurately describe your content</li><li>- <strong>Mix popular and niche:</strong> Combine high-volume hashtags- with specific niche tags+ <strong>Mix popular and niche:</strong> Combine high-volume hashtags with specific niche tags</li><li>- <strong>Research trending tags:</strong> Stay current with trending- topics in your niche+ <strong>Research trending tags:</strong> Stay current with trending topics in your niche</li><li>- <strong>Don't overuse:</strong> Follow platform-specific best- practices for hashtag counts+ <strong>Don't overuse:</strong> Follow platform-specific best practices for hashtag counts</li><li>- <strong>Track performance:</strong> Monitor which hashtags drive the- most engagement+ <strong>Track performance:</strong> Monitor which hashtags drive the most engagement</li></ul>{platform.maxHashtags && (<div className="bg-emerald-50 dark:bg-emerald-900/20 border border-emerald-200 dark:border-emerald-800 rounded-lg p-4 mb-6">- <h4 className="font-semibold text-emerald-900 dark:text-emerald-100 mb-2">- Platform Guidelines- </h4>+ <h4 className="font-semibold text-emerald-900 dark:text-emerald-100 mb-2">Platform Guidelines</h4><ul className="space-y-1 text-sm text-emerald-800 dark:text-emerald-200"><li><strong>Maximum hashtags:</strong> {platform.maxHashtags}</li>{platform.characterLimit && (<li>- <strong>Character limit:</strong> {platform.characterLimit}{" "}- total characters+ <strong>Character limit:</strong> {platform.characterLimit} total characters</li>)}</ul>@@ -814,10 +890,9 @@ export default async function PlatformToolPage({ params }: PageProps) {)}<p className="text-sm text-neutral-600 dark:text-neutral-400 mt-6">- <strong>Note:</strong> While this tool generates strategic hashtags,- always review and customize them based on your specific content and- audience. The most effective hashtags are relevant, timely, and- authentic to your brand.+ <strong>Note:</strong> While this tool generates strategic hashtags, always review and customize them based on+ your specific content and audience. The most effective hashtags are relevant, timely, and authentic to your+ brand.</p></>);@@ -829,7 +904,11 @@ export default async function PlatformToolPage({ params }: PageProps) {},{question: "What hashtag strategies are available?",- answer: `You can choose from ${platform.hashtagStrategies.length} strategies: ${platform.hashtagStrategies.join(", ")}. Each strategy is optimized for ${platform.name} and designed to help you achieve different goals like viral reach, niche engagement, or community building.`,+ answer: `You can choose from ${platform.hashtagStrategies.length} strategies: ${platform.hashtagStrategies.join(+ ", "+ )}. Each strategy is optimized for ${+ platform.name+ } and designed to help you achieve different goals like viral reach, niche engagement, or community building.`,},{question: "Should I use all the generated hashtags?",@@ -848,13 +927,9 @@ export default async function PlatformToolPage({ params }: PageProps) {question: "How can Rybbit help me track hashtag performance?",answer: (<>- Rybbit helps you measure which content and hashtags drive the most- engagement on {platform.name}. Track clicks, traffic sources, and- content performance to optimize your hashtag strategy.{" "}- <a- href="https://rybbit.com"- className="text-emerald-600 hover:text-emerald-500 underline"- >+ Rybbit helps you measure which content and hashtags drive the most engagement on {platform.name}. Track+ clicks, traffic sources, and content performance to optimize your hashtag strategy.{" "}+ <a href="https://rybbit.com" className="text-emerald-600 hover:text-emerald-500 underline">Start tracking for free</a>.@@ -912,36 +987,25 @@ export default async function PlatformToolPage({ params }: PageProps) {const educationalContent = (<>- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">- About {platform.name} Usernames- </h2>- <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">- {platform.educationalContent}- </p>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">About {platform.name} Usernames</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">{platform.educationalContent}</p>- <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">- How to Use This Tool- </h3>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">How to Use This Tool</h3><ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li>- <strong>Enter your name or brand</strong> - What should the- username be based on?+ <strong>Enter your name or brand</strong> - What should the username be based on?</li><li>- <strong>Add interests (optional)</strong> - Include keywords or- interests to incorporate+ <strong>Add interests (optional)</strong> - Include keywords or interests to incorporate</li><li>- <strong>Choose number preference</strong> - Decide if you want- numbers included+ <strong>Choose number preference</strong> - Decide if you want numbers included</li><li>- <strong>Click "Generate Usernames"</strong> to get 5 unique- suggestions+ <strong>Click "Generate Usernames"</strong> to get 5 unique suggestions</li><li>- <strong>Check availability</strong> on {platform.name} and claim- your favorite+ <strong>Check availability</strong> on {platform.name} and claim your favorite</li></ol>@@ -950,55 +1014,44 @@ export default async function PlatformToolPage({ params }: PageProps) {</h3><ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li>- <strong>Keep it memorable:</strong> Choose something easy to spell- and remember+ <strong>Keep it memorable:</strong> Choose something easy to spell and remember</li><li>- <strong>Make it brandable:</strong> Think long-term - will this- still work in 5 years?+ <strong>Make it brandable:</strong> Think long-term - will this still work in 5 years?</li><li>- <strong>Avoid excessive numbers:</strong> Numbers make usernames- harder to remember and share+ <strong>Avoid excessive numbers:</strong> Numbers make usernames harder to remember and share</li><li>- <strong>Check availability:</strong> Always verify the username is- available before committing+ <strong>Check availability:</strong> Always verify the username is available before committing</li><li>- <strong>Be consistent:</strong> Use the same or similar username- across platforms when possible+ <strong>Be consistent:</strong> Use the same or similar username across platforms when possible</li></ul><div className="bg-emerald-50 dark:bg-emerald-900/20 border border-emerald-200 dark:border-emerald-800 rounded-lg p-4 mb-6">- <h4 className="font-semibold text-emerald-900 dark:text-emerald-100 mb-2">- Platform Requirements- </h4>+ <h4 className="font-semibold text-emerald-900 dark:text-emerald-100 mb-2">Platform Requirements</h4><ul className="space-y-1 text-sm text-emerald-800 dark:text-emerald-200"><li>- <strong>Allowed characters:</strong>{" "}- {platform.allowedCharacters}+ <strong>Allowed characters:</strong> {platform.allowedCharacters}</li>{platform.characterLimit && (<li>- <strong>Maximum length:</strong> {platform.characterLimit}{" "}- characters+ <strong>Maximum length:</strong> {platform.characterLimit} characters</li>)}{platform.minLength && (<li>- <strong>Minimum length:</strong> {platform.minLength}{" "}- characters+ <strong>Minimum length:</strong> {platform.minLength} characters</li>)}</ul></div><p className="text-sm text-neutral-600 dark:text-neutral-400 mt-6">- <strong>Note:</strong> Always check availability on {platform.name}{" "}- before settling on a username. Generated suggestions are not- guaranteed to be available.+ <strong>Note:</strong> Always check availability on {platform.name} before settling on a username. Generated+ suggestions are not guaranteed to be available.</p></>);@@ -1030,13 +1083,9 @@ export default async function PlatformToolPage({ params }: PageProps) {question: "How can Rybbit help me grow my presence?",answer: (<>- Once you've claimed your username, Rybbit helps you track- engagement, clicks, and growth on {platform.name}. Understand your- audience and optimize your content strategy.{" "}- <a- href="https://rybbit.com"- className="text-emerald-600 hover:text-emerald-500 underline"- >+ Once you've claimed your username, Rybbit helps you track engagement, clicks, and growth on {platform.name}.+ Understand your audience and optimize your content strategy.{" "}+ <a href="https://rybbit.com" className="text-emerald-600 hover:text-emerald-500 underline">Start tracking for free</a>.@@ -1094,43 +1143,31 @@ export default async function PlatformToolPage({ params }: PageProps) {const educationalContent = (<>- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">- About {platform.name} Posts- </h2>- <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">- {platform.educationalContent}- </p>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">About {platform.name} Posts</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">{platform.educationalContent}</p>- <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">- How to Use This Tool- </h3>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">How to Use This Tool</h3><ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li>- <strong>Describe your topic</strong> - What do you want to post- about?+ <strong>Describe your topic</strong> - What do you want to post about?</li><li>- <strong>Select a style</strong> - Choose from{" "}- {platform.recommendedStyles.length} platform-optimized styles+ <strong>Select a style</strong> - Choose from {platform.recommendedStyles.length} platform-optimized styles</li><li>- <strong>Add context (optional)</strong> - Include specific details,- CTAs, or hashtags+ <strong>Add context (optional)</strong> - Include specific details, CTAs, or hashtags</li><li><strong>Click "Generate Posts"</strong> to get 3 unique variations</li><li>- <strong>Copy and customize</strong> your favorite post before- publishing+ <strong>Copy and customize</strong> your favorite post before publishing</li></ol>- <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">- Available Post Styles- </h3>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">Available Post Styles</h3><ul className="grid grid-cols-2 gap-2 text-sm text-neutral-700 dark:text-neutral-300 mb-6">- {platform.recommendedStyles.map((style) => (+ {platform.recommendedStyles.map(style => (<li key={style} className="flex items-center gap-2"><span className="w-1.5 h-1.5 rounded-full bg-emerald-500" />{style}@@ -1143,31 +1180,25 @@ export default async function PlatformToolPage({ params }: PageProps) {</h3><ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li>- <strong>Be authentic:</strong> Personalize AI-generated content to- match your voice+ <strong>Be authentic:</strong> Personalize AI-generated content to match your voice</li><li>- <strong>Add value:</strong> Ensure your post provides insights,- entertainment, or useful information+ <strong>Add value:</strong> Ensure your post provides insights, entertainment, or useful information</li><li>- <strong>Engage your audience:</strong> Include questions or CTAs to- encourage interaction+ <strong>Engage your audience:</strong> Include questions or CTAs to encourage interaction</li><li>- <strong>Optimize timing:</strong> Post when your audience is most- active+ <strong>Optimize timing:</strong> Post when your audience is most active</li><li>- <strong>Review before posting:</strong> Always edit and customize- generated content+ <strong>Review before posting:</strong> Always edit and customize generated content</li></ul><p className="text-sm text-neutral-600 dark:text-neutral-400 mt-6">- <strong>Note:</strong> While this tool generates high-quality posts,- always review and personalize content before publishing. Authentic- engagement comes from adding your unique perspective and voice.+ <strong>Note:</strong> While this tool generates high-quality posts, always review and personalize content+ before publishing. Authentic engagement comes from adding your unique perspective and voice.</p></>);@@ -1179,7 +1210,11 @@ export default async function PlatformToolPage({ params }: PageProps) {},{question: "What post styles are available?",- answer: `You can choose from ${platform.recommendedStyles.length} styles: ${platform.recommendedStyles.join(", ")}. Each style is optimized for ${platform.name} and designed to maximize engagement for different types of content.`,+ answer: `You can choose from ${platform.recommendedStyles.length} styles: ${platform.recommendedStyles.join(+ ", "+ )}. Each style is optimized for ${+ platform.name+ } and designed to maximize engagement for different types of content.`,},{question: "Should I edit the generated posts?",@@ -1199,13 +1234,9 @@ export default async function PlatformToolPage({ params }: PageProps) {question: "How can Rybbit help me measure post performance?",answer: (<>- Rybbit tracks clicks, engagement, and traffic from your{" "}- {platform.name} posts. See which content drives the most interaction- and optimize your social media strategy.{" "}- <a- href="https://rybbit.com"- className="text-emerald-600 hover:text-emerald-500 underline"- >+ Rybbit tracks clicks, engagement, and traffic from your {platform.name} posts. See which content drives the+ most interaction and optimize your social media strategy.{" "}+ <a href="https://rybbit.com" className="text-emerald-600 hover:text-emerald-500 underline">Start tracking for free</a>.@@ -1266,21 +1297,16 @@ export default async function PlatformToolPage({ params }: PageProps) {<h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">About {platform.name} {platform.pageType} Names</h2>- <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">- {platform.educationalContent}- </p>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">{platform.educationalContent}</p>- <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">- How to Use This Tool- </h3>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">How to Use This Tool</h3><ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li>- <strong>Describe your {platform.pageType.toLowerCase()}</strong> -- What's it about? What topics will you cover?+ <strong>Describe your {platform.pageType.toLowerCase()}</strong> - What's it about? What topics will you+ cover?</li><li>- <strong>Add keywords (optional)</strong> - Include specific terms- you want in the name+ <strong>Add keywords (optional)</strong> - Include specific terms you want in the name</li><li><strong>Choose name length</strong> - Short, medium, or long@@ -1289,8 +1315,7 @@ export default async function PlatformToolPage({ params }: PageProps) {<strong>Click "Generate Names"</strong> to get 5 unique suggestions</li><li>- <strong>Copy your favorite</strong> and use it for your{" "}- {platform.name} {platform.pageType.toLowerCase()}+ <strong>Copy your favorite</strong> and use it for your {platform.name} {platform.pageType.toLowerCase()}</li></ol>@@ -1299,31 +1324,26 @@ export default async function PlatformToolPage({ params }: PageProps) {</h3><ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li>- <strong>Keep it memorable:</strong> Choose a name that's easy to- remember and spell+ <strong>Keep it memorable:</strong> Choose a name that's easy to remember and spell</li><li>- <strong>Make it relevant:</strong> The name should clearly reflect- your content or purpose+ <strong>Make it relevant:</strong> The name should clearly reflect your content or purpose</li><li>- <strong>Consider SEO:</strong> Include keywords that people might- search for+ <strong>Consider SEO:</strong> Include keywords that people might search for</li><li>- <strong>Check availability:</strong> Make sure the name isn't- already taken on {platform.name}+ <strong>Check availability:</strong> Make sure the name isn't already taken on {platform.name}</li><li>- <strong>Think long-term:</strong> Choose a name that will still work- as your {platform.pageType.toLowerCase()} grows+ <strong>Think long-term:</strong> Choose a name that will still work as your{" "}+ {platform.pageType.toLowerCase()} grows</li></ul><p className="text-sm text-neutral-600 dark:text-neutral-400 mt-6">- <strong>Note:</strong> Always check if your chosen name is available- on {platform.name} before committing to it. The best names are unique,- memorable, and accurately represent your content.+ <strong>Note:</strong> Always check if your chosen name is available on {platform.name} before committing to+ it. The best names are unique, memorable, and accurately represent your content.</p></>);@@ -1357,13 +1377,9 @@ export default async function PlatformToolPage({ params }: PageProps) {question: "How can Rybbit help me grow my presence?",answer: (<>- Rybbit helps you track engagement, clicks, and traffic sources from- your {platform.name} presence. Understand what content resonates with- your audience and optimize your strategy.{" "}- <a- href="https://rybbit.com"- className="text-emerald-600 hover:text-emerald-500 underline"- >+ Rybbit helps you track engagement, clicks, and traffic sources from your {platform.name} presence.+ Understand what content resonates with your audience and optimize your strategy.{" "}+ <a href="https://rybbit.com" className="text-emerald-600 hover:text-emerald-500 underline">Start tracking for free</a>.@@ -1383,7 +1399,9 @@ export default async function PlatformToolPage({ params }: PageProps) {faqs={faqs}relatedToolsCategory="social-media"ctaTitle={`Grow your ${platform.name} presence with Rybbit`}- ctaDescription={`Track performance and engagement from your ${platform.name} ${platform.pageType.toLowerCase()} to understand what works.`}+ ctaDescription={`Track performance and engagement from your ${+ platform.name+ } ${platform.pageType.toLowerCase()} to understand what works.`}ctaEventLocation={`${platform.id}_page_name_generator_cta`}structuredData={structuredData}/>@@ -1421,35 +1439,25 @@ export default async function PlatformToolPage({ params }: PageProps) {const educationalContent = (<>- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">- About {platform.name} Comments- </h2>- <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">- {platform.educationalContent}- </p>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">About {platform.name} Comments</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">{platform.educationalContent}</p>- <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">- How to Use This Tool- </h3>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">How to Use This Tool</h3><ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li>- <strong>Paste the original content</strong> you want to comment on- in the text area+ <strong>Paste the original content</strong> you want to comment on in the text area</li><li>- <strong>Select your desired tone</strong> (friendly, professional,- humorous, etc.)+ <strong>Select your desired tone</strong> (friendly, professional, humorous, etc.)</li><li><strong>Choose comment length</strong> based on your preference</li><li>- <strong>Click "Generate Comments"</strong> to create 3 unique- variations+ <strong>Click "Generate Comments"</strong> to create 3 unique variations</li><li>- <strong>Copy your favorite</strong> and paste it into{" "}- {platform.name}+ <strong>Copy your favorite</strong> and paste it into {platform.name}</li></ol>@@ -1458,31 +1466,25 @@ export default async function PlatformToolPage({ params }: PageProps) {</h3><ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li>- <strong>Be authentic:</strong> Even AI-generated comments should- feel genuine and personal+ <strong>Be authentic:</strong> Even AI-generated comments should feel genuine and personal</li><li>- <strong>Add context:</strong> Reference specific parts of the- original content+ <strong>Add context:</strong> Reference specific parts of the original content</li><li>- <strong>Encourage dialogue:</strong> Ask questions or invite further- discussion+ <strong>Encourage dialogue:</strong> Ask questions or invite further discussion</li><li>- <strong>Match the tone:</strong> Respect the original post's mood- and purpose+ <strong>Match the tone:</strong> Respect the original post's mood and purpose</li><li>- <strong>Personalize before posting:</strong> Edit generated comments- to add your unique voice+ <strong>Personalize before posting:</strong> Edit generated comments to add your unique voice</li></ul><p className="text-sm text-neutral-600 dark:text-neutral-400 mt-6">- <strong>Note:</strong> While this tool generates comments using AI,- always review and personalize them before posting. Authentic- engagement is key to building genuine connections on {platform.name}.+ <strong>Note:</strong> While this tool generates comments using AI, always review and personalize them before+ posting. Authentic engagement is key to building genuine connections on {platform.name}.</p></>);@@ -1506,9 +1508,8 @@ export default async function PlatformToolPage({ params }: PageProps) {question: "How many comments can I generate?",answer: (<>- The tool generates 3 unique comment variations per request. You're- limited to 5 requests per minute to ensure fair usage and maintain- service quality for all users.+ The tool generates 3 unique comment variations per request. You're limited to 5 requests per minute to+ ensure fair usage and maintain service quality for all users.</>),},@@ -1520,14 +1521,9 @@ export default async function PlatformToolPage({ params }: PageProps) {question: "How can Rybbit help me track comment engagement?",answer: (<>- Rybbit helps you measure which content drives the most engagement- and comments on your social media. Track clicks, traffic sources,- and content performance to understand what resonates with your- audience.{" "}- <a- href="https://rybbit.com"- className="text-emerald-600 hover:text-emerald-500 underline"- >+ Rybbit helps you measure which content drives the most engagement and comments on your social media. Track+ clicks, traffic sources, and content performance to understand what resonates with your audience.{" "}+ <a href="https://rybbit.com" className="text-emerald-600 hover:text-emerald-500 underline">Start tracking for free</a>.@@ -1584,16 +1580,10 @@ export default async function PlatformToolPage({ params }: PageProps) {const educationalContent = (<>- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">- About {platform.name} Font Styles- </h2>- <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">- {platform.educationalContent}- </p>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">About {platform.name} Font Styles</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">{platform.educationalContent}</p>- <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">- How to Use- </h3>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">How to Use</h3><ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6"><li><strong>Type your text</strong> in the input box above@@ -1605,15 +1595,13 @@ export default async function PlatformToolPage({ params }: PageProps) {<strong>Click "Copy"</strong> on any style you like</li><li>- <strong>Paste it</strong> into your {platform.name} posts, comments,- or bio+ <strong>Paste it</strong> into your {platform.name} posts, comments, or bio</li></ol><p className="text-sm text-neutral-600 dark:text-neutral-400 mt-6">- <strong>Note:</strong> These fonts use Unicode characters and work- across most platforms and devices. However, some fonts may not display- correctly on older systems or certain applications.+ <strong>Note:</strong> These fonts use Unicode characters and work across most platforms and devices. However,+ some fonts may not display correctly on older systems or certain applications.</p></>);@@ -1645,13 +1633,9 @@ export default async function PlatformToolPage({ params }: PageProps) {question: "How can Rybbit help me track my social media performance?",answer: (<>- Rybbit helps you track clicks, engagement, and traffic sources from- your {platform.name} posts and bio links. See which content drives the- most engagement and optimize your social media strategy.{" "}- <a- href="https://rybbit.com"- className="text-emerald-600 hover:text-emerald-500 underline"- >+ Rybbit helps you track clicks, engagement, and traffic sources from your {platform.name} posts and bio links.+ See which content drives the most engagement and optimize your social media strategy.{" "}+ <a href="https://rybbit.com" className="text-emerald-600 hover:text-emerald-500 underline">Start tracking for free</a>.@@ -1666,12 +1650,7 @@ export default async function PlatformToolPage({ params }: PageProps) {title={platform.displayName}description={platform.description}badge="Free Tool"- toolComponent={- <FontGeneratorTool- platformName={platform.name}- characterLimit={platform.characterLimit}- />- }+ toolComponent={<FontGeneratorTool platformName={platform.name} characterLimit={platform.characterLimit} />}educationalContent={educationalContent}faqs={fontFaqs}relatedToolsCategory="social-media"diff --git a/docs/src/app/(home)/tools/components/ImageResizer.tsx b/docs/src/app/(home)/tools/components/ImageResizer.tsxnew file mode 100644index 000000000..6220c9256--- /dev/null+++ b/docs/src/app/(home)/tools/components/ImageResizer.tsx@@ -0,0 +1,248 @@+"use client";++import { useState, useCallback, useRef } from "react";+import Cropper, { Area } from "react-easy-crop";+import { Upload, Download, RotateCw, ZoomIn, Image as ImageIcon, X } from "lucide-react";+import { ImageResizerPlatformConfig } from "./image-resizer-platform-configs";+import getCroppedImg from "./image-resizer-utils";++interface ImageResizerProps {+ platform: ImageResizerPlatformConfig;+}++export default function ImageResizer({ platform }: ImageResizerProps) {+ const [imageSrc, setImageSrc] = useState<string | null>(null);+ const [crop, setCrop] = useState({ x: 0, y: 0 });+ const [zoom, setZoom] = useState(1);+ const [rotation, setRotation] = useState(0);+ const [selectedDimensionIndex, setSelectedDimensionIndex] = useState(0);+ const [croppedAreaPixels, setCroppedAreaPixels] = useState<Area | null>(null);+ const [isGenerating, setIsGenerating] = useState(false);+ const fileInputRef = useRef<HTMLInputElement>(null);++ const selectedDimension = platform.dimensions[selectedDimensionIndex];++ // Calculate aspect ratio from dimensions if not explicitly provided+ const aspect = selectedDimension.aspectRatio ?? (selectedDimension.width / selectedDimension.height);++ const onCropComplete = useCallback((croppedArea: Area, croppedAreaPixels: Area) => {+ setCroppedAreaPixels(croppedAreaPixels);+ }, []);++ const onFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {+ if (e.target.files && e.target.files.length > 0) {+ const file = e.target.files[0];+ const reader = new FileReader();+ reader.addEventListener("load", () => {+ setImageSrc(reader.result?.toString() || null);+ setZoom(1);+ setRotation(0);+ });+ reader.readAsDataURL(file);+ }+ };++ const onDownload = async () => {+ if (!imageSrc || !croppedAreaPixels) return;++ try {+ setIsGenerating(true);+ const croppedImage = await getCroppedImg(+ imageSrc,+ croppedAreaPixels,+ rotation,+ { horizontal: false, vertical: false },+ selectedDimension.width,+ selectedDimension.height+ );++ if (croppedImage) {+ const link = document.createElement("a");+ link.download = `${platform.id}-${selectedDimension.label.toLowerCase().replace(/\s+/g, "-")}.jpg`;+ link.href = croppedImage;+ document.body.appendChild(link);+ link.click();+ document.body.removeChild(link);+ }+ } catch (e) {+ console.error(e);+ } finally {+ setIsGenerating(false);+ }+ };++ const triggerFileInput = () => {+ fileInputRef.current?.click();+ };++ const resetImage = () => {+ setImageSrc(null);+ setZoom(1);+ setRotation(0);+ };++ return (+ <div className="space-y-8">+ {/* Controls Section */}+ <div className="space-y-4">+ <label className="block text-sm font-medium text-neutral-700 dark:text-neutral-300">+ Select Image Type+ </label>+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-3">+ {platform.dimensions.map((dim, index) => (+ <button+ key={index}+ onClick={() => setSelectedDimensionIndex(index)}+ className={`p-3 rounded-lg border text-left transition-all ${+ selectedDimensionIndex === index+ ? "border-emerald-500 bg-emerald-50 dark:bg-emerald-900/20 ring-1 ring-emerald-500"+ : "border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-800 hover:border-emerald-300 dark:hover:border-emerald-700"+ }`}+ >+ <div className="font-medium text-neutral-900 dark:text-white">+ {dim.label}+ </div>+ <div className="text-sm text-neutral-500 dark:text-neutral-400 mt-1">+ {dim.width} x {dim.height} px+ </div>+ {dim.description && (+ <div className="text-xs text-neutral-400 dark:text-neutral-500 mt-1">+ {dim.description}+ </div>+ )}+ </button>+ ))}+ </div>+ </div>++ {/* Editor Section */}+ <div className="bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-xl overflow-hidden">+ {!imageSrc ? (+ <div+ className="h-80 flex flex-col items-center justify-center bg-neutral-50 dark:bg-neutral-900/50 cursor-pointer hover:bg-neutral-100 dark:hover:bg-neutral-900 transition-colors border-2 border-dashed border-neutral-300 dark:border-neutral-700 m-4 rounded-lg"+ onClick={triggerFileInput}+ >+ <input+ type="file"+ accept="image/*"+ onChange={onFileChange}+ className="hidden"+ ref={fileInputRef}+ />+ <div className="p-4 bg-emerald-100 dark:bg-emerald-900/30 rounded-full mb-4">+ <Upload className="w-8 h-8 text-emerald-600 dark:text-emerald-400" />+ </div>+ <p className="text-lg font-medium text-neutral-900 dark:text-white mb-1">+ Upload an image+ </p>+ <p className="text-sm text-neutral-500 dark:text-neutral-400">+ JPG, PNG, or WebP (Max 10MB)+ </p>+ </div>+ ) : (+ <div className="flex flex-col">+ <div className="relative h-[500px] w-full bg-neutral-900">+ <Cropper+ image={imageSrc}+ crop={crop}+ zoom={zoom}+ rotation={rotation}+ aspect={aspect}+ onCropChange={setCrop}+ onCropComplete={onCropComplete}+ onZoomChange={setZoom}+ onRotationChange={setRotation}+ />+ <button+ onClick={resetImage}+ className="absolute top-4 right-4 p-2 bg-black/50 hover:bg-black/70 text-white rounded-full backdrop-blur-sm transition-colors z-10"+ title="Remove image"+ >+ <X className="w-5 h-5" />+ </button>+ </div>++ {/* Editing Controls */}+ <div className="p-6 space-y-6 border-t border-neutral-200 dark:border-neutral-700">+ <div className="grid grid-cols-1 md:grid-cols-2 gap-6">+ <div className="space-y-2">+ <div className="flex justify-between text-sm text-neutral-600 dark:text-neutral-400">+ <span className="flex items-center gap-2">+ <ZoomIn className="w-4 h-4" /> Zoom+ </span>+ <span>{Math.round(zoom * 100)}%</span>+ </div>+ <input+ type="range"+ value={zoom}+ min={1}+ max={3}+ step={0.1}+ aria-labelledby="Zoom"+ onChange={(e) => setZoom(Number(e.target.value))}+ className="w-full h-2 bg-neutral-200 dark:bg-neutral-700 rounded-lg appearance-none cursor-pointer accent-emerald-600"+ />+ </div>++ <div className="space-y-2">+ <div className="flex justify-between text-sm text-neutral-600 dark:text-neutral-400">+ <span className="flex items-center gap-2">+ <RotateCw className="w-4 h-4" /> Rotation+ </span>+ <span>{rotation}°</span>+ </div>+ <input+ type="range"+ value={rotation}+ min={0}+ max={360}+ step={1}+ aria-labelledby="Rotation"+ onChange={(e) => setRotation(Number(e.target.value))}+ className="w-full h-2 bg-neutral-200 dark:bg-neutral-700 rounded-lg appearance-none cursor-pointer accent-emerald-600"+ />+ </div>+ </div>++ <div className="flex items-center justify-between pt-4 border-t border-neutral-200 dark:border-neutral-700">+ <div className="text-sm text-neutral-500 dark:text-neutral-400">+ Output: <span className="font-mono text-neutral-900 dark:text-white">{selectedDimension.width} x {selectedDimension.height}px</span>+ </div>+ <button+ onClick={onDownload}+ disabled={isGenerating}+ className="px-6 py-2.5 bg-emerald-600 hover:bg-emerald-500 text-white font-medium rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed"+ >+ {isGenerating ? (+ "Processing..."+ ) : (+ <>+ <Download className="w-4 h-4" /> Download Image+ </>+ )}+ </button>+ </div>+ </div>+ </div>+ )}+ </div>++ <div className="p-4 bg-neutral-50 dark:bg-neutral-800/50 border border-neutral-200 dark:border-neutral-700 rounded-lg">+ <div className="flex gap-3">+ <div className="p-2 bg-emerald-100 dark:bg-emerald-900/30 rounded-lg h-fit">+ <ImageIcon className="w-5 h-5 text-emerald-600 dark:text-emerald-400" />+ </div>+ <div>+ <h3 className="text-sm font-medium text-neutral-900 dark:text-white mb-1">+ Why use this tool?+ </h3>+ <p className="text-sm text-neutral-600 dark:text-neutral-400">+ {platform.educationalContent} This tool ensures your images are perfectly sized to avoid automatic cropping or quality loss.+ </p>+ </div>+ </div>+ </div>+ </div>+ );+}+diff --git a/docs/src/app/(home)/tools/components/image-resizer-platform-configs.ts b/docs/src/app/(home)/tools/components/image-resizer-platform-configs.tsnew file mode 100644index 000000000..aff66e9a8--- /dev/null+++ b/docs/src/app/(home)/tools/components/image-resizer-platform-configs.ts@@ -0,0 +1,526 @@+export interface ImageDimension {+ label: string;+ width: number;+ height: number;+ aspectRatio?: number; // width / height+ description?: string;+}++export interface ImageResizerPlatformConfig {+ id: string;+ name: string;+ displayName: string;+ description: string;+ educationalContent: string;+ simpleIconSlug: string;+ colorHex: string;+ dimensions: ImageDimension[];+}++export const imageResizerPlatformConfigs: Record<string, ImageResizerPlatformConfig> = {+ facebook: {+ id: "facebook",+ name: "Facebook",+ displayName: "Facebook Photo Resizer",+ description:+ "Resize and crop images for Facebook profiles, covers, posts, and stories. Ensure your content looks perfect on all devices.",+ educationalContent:+ "Facebook has specific image dimensions for different placement types to ensure optimal display quality. Using the correct size prevents automatic cropping or compression artifacts.",+ simpleIconSlug: "facebook",+ colorHex: "0866FF",+ dimensions: [+ {+ label: "Profile Picture",+ width: 170,+ height: 170,+ aspectRatio: 1,+ description: "Displays at 170x170 on desktop, 128x128 on smartphones.",+ },+ {+ label: "Cover Photo",+ width: 851,+ height: 315,+ aspectRatio: 851 / 315,+ description: "Displays at 820x312 on desktop, 640x360 on smartphones.",+ },+ {+ label: "Shared Image (Post)",+ width: 1200,+ height: 630,+ aspectRatio: 1.91,+ description: "Recommended size for shared link images.",+ },+ { label: "Story", width: 1080, height: 1920, aspectRatio: 9 / 16, description: "Full screen vertical image." },+ {+ label: "Event Cover",+ width: 1920,+ height: 1005,+ aspectRatio: 1920 / 1005,+ description: "For Facebook events.",+ },+ ],+ },+ instagram: {+ id: "instagram",+ name: "Instagram",+ displayName: "Instagram Photo Resizer",+ description:+ "Crop and resize photos for Instagram posts, stories, and profile pictures. Create perfect squares or vertical visuals.",+ educationalContent:+ "Instagram is a visual-first platform. High-quality, correctly sized images are essential for engagement. It supports square, landscape, and portrait orientations.",+ simpleIconSlug: "instagram",+ colorHex: "E4405F",+ dimensions: [+ { label: "Profile Picture", width: 320, height: 320, aspectRatio: 1, description: "Circular crop." },+ { label: "Square Post", width: 1080, height: 1080, aspectRatio: 1, description: "The classic Instagram format." },+ {+ label: "Portrait Post",+ width: 1080,+ height: 1350,+ aspectRatio: 4 / 5,+ description: "Takes up more vertical screen space.",+ },+ { label: "Landscape Post", width: 1080, height: 566, aspectRatio: 1.91, description: "Cinematic wide format." },+ {+ label: "Story / Reel Cover",+ width: 1080,+ height: 1920,+ aspectRatio: 9 / 16,+ description: "Full screen vertical format.",+ },+ ],+ },+ x: {+ id: "x",+ name: "X (Twitter)",+ displayName: "X (Twitter) Photo Resizer",+ description: "Resize images for X posts, headers, and profile pictures. Optimize your visuals for the timeline.",+ educationalContent:+ "On X (formerly Twitter), images in the timeline are often cropped if they don't match standard aspect ratios. Using the right dimensions ensures your full image is visible.",+ simpleIconSlug: "x",+ colorHex: "000000",+ dimensions: [+ { label: "Profile Picture", width: 400, height: 400, aspectRatio: 1, description: "Circular display." },+ { label: "Header Photo", width: 1500, height: 500, aspectRatio: 3, description: "Top banner on profile." },+ { label: "In-Stream Photo", width: 1600, height: 900, aspectRatio: 16 / 9, description: "Standard post image." },+ { label: "Card Image", width: 1200, height: 628, aspectRatio: 1.91, description: "For link previews." },+ ],+ },+ linkedin: {+ id: "linkedin",+ name: "LinkedIn",+ displayName: "LinkedIn Photo Resizer",+ description:+ "Professional image resizing for LinkedIn profiles, banners, and company pages. Look your best in the professional network.",+ educationalContent:+ "LinkedIn requires professional-looking imagery. Pixelated or badly cropped images can harm your personal brand or company image.",+ simpleIconSlug: "linkedin",+ colorHex: "0A66C2",+ dimensions: [+ { label: "Profile Picture", width: 400, height: 400, aspectRatio: 1, description: "Personal profile photo." },+ {+ label: "Profile Background",+ width: 1584,+ height: 396,+ aspectRatio: 4,+ description: "Personal profile banner.",+ },+ { label: "Company Logo", width: 300, height: 300, aspectRatio: 1, description: "Company page logo." },+ {+ label: "Company Cover",+ width: 1128,+ height: 191,+ aspectRatio: 1128 / 191,+ description: "Company page banner.",+ },+ { label: "Shared Image", width: 1200, height: 627, aspectRatio: 1.91, description: "Post image." },+ ],+ },+ youtube: {+ id: "youtube",+ name: "YouTube",+ displayName: "YouTube Photo Resizer",+ description:+ "Create perfect YouTube thumbnails, channel art, and profile pictures. maximize your click-through rates.",+ educationalContent:+ "YouTube thumbnails are critical for CTR. Channel art needs to be responsive across TV, desktop, and mobile.",+ simpleIconSlug: "youtube",+ colorHex: "FF0000",+ dimensions: [+ { label: "Channel Profile", width: 800, height: 800, aspectRatio: 1, description: "Circular channel icon." },+ {+ label: "Channel Art (Banner)",+ width: 2560,+ height: 1440,+ aspectRatio: 16 / 9,+ description: "Safe area is 1546x423.",+ },+ { label: "Video Thumbnail", width: 1280, height: 720, aspectRatio: 16 / 9, description: "Standard HD format." },+ ],+ },+ tiktok: {+ id: "tiktok",+ name: "TikTok",+ displayName: "TikTok Photo Resizer",+ description:+ "Resize images for TikTok profile pictures and video covers. Optimize your profile for the For You page.",+ educationalContent:+ "While video-centric, your TikTok profile picture is your brand. Ensure it's clear and centered.",+ simpleIconSlug: "tiktok",+ colorHex: "000000",+ dimensions: [+ { label: "Profile Picture", width: 200, height: 200, aspectRatio: 1, description: "Circular display." },+ {+ label: "Video Cover",+ width: 1080,+ height: 1920,+ aspectRatio: 9 / 16,+ description: "For uploading custom covers.",+ },+ ],+ },+ pinterest: {+ id: "pinterest",+ name: "Pinterest",+ displayName: "Pinterest Photo Resizer",+ description: "Create perfectly sized Pins and board covers. Optimize your images for discovery and saving.",+ educationalContent:+ "Pinterest favors vertical images. Taller images take up more screen real estate and get more attention.",+ simpleIconSlug: "pinterest",+ colorHex: "E60023",+ dimensions: [+ { label: "Profile Picture", width: 165, height: 165, aspectRatio: 1, description: "Circular display." },+ {+ label: "Standard Pin",+ width: 1000,+ height: 1500,+ aspectRatio: 2 / 3,+ description: "Recommended vertical ratio.",+ },+ { label: "Square Pin", width: 1000, height: 1000, aspectRatio: 1, description: "For carousel pins." },+ { label: "Board Cover", width: 600, height: 600, aspectRatio: 1, description: "Square thumbnail for boards." },+ ],+ },+ discord: {+ id: "discord",+ name: "Discord",+ displayName: "Discord Photo Resizer",+ description:+ "Resize images for Discord avatars, server icons, and banners. Customize your server and profile appearance.",+ educationalContent:+ "Discord relies heavily on icons and banners for server identity. Animated GIFs are also supported for Nitro users (static supported here).",+ simpleIconSlug: "discord",+ colorHex: "5865F2",+ dimensions: [+ { label: "Profile Avatar", width: 128, height: 128, aspectRatio: 1, description: "User profile picture." },+ { label: "Server Icon", width: 512, height: 512, aspectRatio: 1, description: "Server logo." },+ {+ label: "Server Banner",+ width: 960,+ height: 540,+ aspectRatio: 16 / 9,+ description: "Background for server list/invite.",+ },+ { label: "Profile Banner", width: 600, height: 240, aspectRatio: 2.5, description: "User profile background." },+ ],+ },+ reddit: {+ id: "reddit",+ name: "Reddit",+ displayName: "Reddit Photo Resizer",+ description:+ "Resize images for Reddit community icons, banners, and posts. Customize your subreddit or user profile.",+ educationalContent:+ "Subreddits need specific icon and banner sizes to look professional. User profiles also support banners.",+ simpleIconSlug: "reddit",+ colorHex: "FF4500",+ dimensions: [+ { label: "Community Icon", width: 256, height: 256, aspectRatio: 1, description: "Subreddit logo." },+ {+ label: "Community Banner",+ width: 4000,+ height: 128,+ aspectRatio: 4000 / 128,+ description: "Top banner for subreddit (Small).",+ },+ {+ label: "Community Banner (Large)",+ width: 4000,+ height: 192,+ aspectRatio: 4000 / 192,+ description: "Top banner for subreddit (Medium).",+ },+ { label: "Profile Avatar", width: 256, height: 256, aspectRatio: 1, description: "User profile picture." },+ {+ label: "Profile Banner",+ width: 1280,+ height: 384,+ aspectRatio: 10 / 3,+ description: "User profile background.",+ },+ ],+ },+ twitch: {+ id: "twitch",+ name: "Twitch",+ displayName: "Twitch Photo Resizer",+ description: "Create Twitch offline screens, profile banners, and panel images. Brand your streaming channel.",+ educationalContent:+ "Consistent branding across your Twitch channel helps retain viewers. Panels are crucial for conveying info.",+ simpleIconSlug: "twitch",+ colorHex: "9146FF",+ dimensions: [+ { label: "Profile Picture", width: 256, height: 256, aspectRatio: 1, description: "Channel avatar." },+ { label: "Profile Banner", width: 1200, height: 480, aspectRatio: 2.5, description: "Header background." },+ { label: "Video Player Banner", width: 1920, height: 1080, aspectRatio: 16 / 9, description: "Offline screen." },+ {+ label: "Panel Image",+ width: 320,+ height: 160,+ aspectRatio: 2,+ description: "Info panels below stream (Width fixed 320px).",+ },+ ],+ },+ bluesky: {+ id: "bluesky",+ name: "Bluesky",+ displayName: "Bluesky Photo Resizer",+ description: "Resize images for Bluesky profiles and posts. Get your decentralized identity looking sharp.",+ educationalContent: "Bluesky uses standard aspect ratios similar to X/Twitter.",+ simpleIconSlug: "bluesky",+ colorHex: "1185FE",+ dimensions: [+ { label: "Profile Picture", width: 400, height: 400, aspectRatio: 1, description: "Circular avatar." },+ { label: "Profile Banner", width: 1500, height: 500, aspectRatio: 3, description: "Header image." },+ ],+ },+ threads: {+ id: "threads",+ name: "Threads",+ displayName: "Threads Photo Resizer",+ description: "Resize photos for Threads profiles and posts. Optimize for Meta's conversation app.",+ educationalContent: "Threads imports from Instagram often, but standalone setup requires specific dimensions.",+ simpleIconSlug: "threads",+ colorHex: "000000",+ dimensions: [+ { label: "Profile Picture", width: 320, height: 320, aspectRatio: 1, description: "Circular avatar." },+ { label: "Post Image", width: 1080, height: 1080, aspectRatio: 1, description: "Square posts work best." },+ ],+ },+ mastodon: {+ id: "mastodon",+ name: "Mastodon",+ displayName: "Mastodon Photo Resizer",+ description: "Resize images for Mastodon profiles and headers. Perfect for the Fediverse.",+ educationalContent: "Mastodon instances may vary, but standard dimensions apply across most servers.",+ simpleIconSlug: "mastodon",+ colorHex: "6364FF",+ dimensions: [+ { label: "Profile Picture", width: 400, height: 400, aspectRatio: 1, description: "Avatar." },+ { label: "Header Image", width: 1500, height: 500, aspectRatio: 3, description: "Profile banner." },+ ],+ },+ snapchat: {+ id: "snapchat",+ name: "Snapchat",+ displayName: "Snapchat Photo Resizer",+ description: "Create content for Snapchat Stories and ads. Vertical format is key.",+ educationalContent: "Snapchat is exclusively vertical. Full screen content works best.",+ simpleIconSlug: "snapchat",+ colorHex: "FFFC00",+ dimensions: [+ { label: "Story / Snap", width: 1080, height: 1920, aspectRatio: 9 / 16, description: "Full screen vertical." },+ { label: "Geofilter", width: 1080, height: 2340, aspectRatio: 6 / 13, description: "Overlay image." },+ ],+ },+ spotify: {+ id: "spotify",+ name: "Spotify",+ displayName: "Spotify Photo Resizer",+ description:+ "Resize images for Spotify playlists and artist profiles. Professionalize your music or podcast presence.",+ educationalContent: "Playlist covers are often the first thing listeners see.",+ simpleIconSlug: "spotify",+ colorHex: "1DB954",+ dimensions: [+ { label: "Playlist Cover", width: 640, height: 640, aspectRatio: 1, description: "Square image." },+ {+ label: "Artist Header",+ width: 2660,+ height: 1140,+ aspectRatio: 2660 / 1140,+ description: "Banner for artist profiles.",+ },+ { label: "Artist Avatar", width: 750, height: 750, aspectRatio: 1, description: "Profile picture." },+ ],+ },+ steam: {+ id: "steam",+ name: "Steam",+ displayName: "Steam Photo Resizer",+ description: "Create Steam avatars and workshop images. Customize your gaming profile.",+ educationalContent: "Steam avatars appear in many sizes (184px, 64px, 32px).",+ simpleIconSlug: "steam",+ colorHex: "000000",+ dimensions: [{ label: "Avatar", width: 184, height: 184, aspectRatio: 1, description: "Main profile avatar." }],+ },+ vk: {+ id: "vk",+ name: "VK",+ displayName: "VK Photo Resizer",+ description: "Resize images for VK posts, communities, and profiles.",+ educationalContent: "VK supports high resolution uploads.",+ simpleIconSlug: "vk",+ colorHex: "0077FF",+ dimensions: [+ {+ label: "Profile Photo",+ width: 200,+ height: 500,+ aspectRatio: 2 / 5,+ description: "Can be rectangular vertical.",+ },+ { label: "Community Cover", width: 1590, height: 530, aspectRatio: 3, description: "Header for groups." },+ { label: "Post Image", width: 700, height: 500, aspectRatio: 1.4, description: "Standard post." },+ ],+ },+ tumblr: {+ id: "tumblr",+ name: "Tumblr",+ displayName: "Tumblr Photo Resizer",+ description: "Resize images for Tumblr blogs and posts.",+ educationalContent: "Tumblr is flexible but specific dimensions help themes look better.",+ simpleIconSlug: "tumblr",+ colorHex: "36465D",+ dimensions: [+ { label: "Profile Avatar", width: 128, height: 128, aspectRatio: 1, description: "Square icon." },+ { label: "Header Image", width: 3000, height: 1055, aspectRatio: 3000 / 1055, description: "Blog header." },+ ],+ },+ substack: {+ id: "substack",+ name: "Substack",+ displayName: "Substack Photo Resizer",+ description: "Resize publication logos and cover images for Substack.",+ educationalContent: "Clean visuals help newsletters stand out in inboxes.",+ simpleIconSlug: "substack",+ colorHex: "FF6719",+ dimensions: [+ { label: "Publication Logo", width: 256, height: 256, aspectRatio: 1, description: "Square logo." },+ { label: "Cover Image", width: 600, height: 600, aspectRatio: 1, description: "Social preview image." },+ ],+ },+ telegram: {+ id: "telegram",+ name: "Telegram",+ displayName: "Telegram Photo Resizer",+ description: "Resize images for Telegram profiles and channels.",+ educationalContent: "Telegram uses circular crops for profiles and channels.",+ simpleIconSlug: "telegram",+ colorHex: "26A5E4",+ dimensions: [+ { label: "Profile Photo", width: 640, height: 640, aspectRatio: 1, description: "User or channel icon." },+ ],+ },+ nostr: {+ id: "nostr",+ name: "Nostr",+ displayName: "Nostr Photo Resizer",+ description: "Resize images for Nostr clients.",+ educationalContent: "Nostr clients often use standard social media dimensions.",+ simpleIconSlug: "nostr",+ colorHex: "8E30EB",+ dimensions: [+ { label: "Profile Picture", width: 400, height: 400, aspectRatio: 1, description: "Avatar." },+ { label: "Banner", width: 1500, height: 500, aspectRatio: 3, description: "Profile header." },+ ],+ },+ dribbble: {+ id: "dribbble",+ name: "Dribbble",+ displayName: "Dribbble Photo Resizer",+ description: "Format your design shots for Dribbble.",+ educationalContent: "Dribbble shots have very specific requirements to look crisp.",+ simpleIconSlug: "dribbble",+ colorHex: "EA4C89",+ dimensions: [+ {+ label: "Shot",+ width: 1600,+ height: 1200,+ aspectRatio: 4 / 3,+ description: "Standard shot size (High DPI recommended).",+ },+ ],+ },+ lemmy: {+ id: "lemmy",+ name: "Lemmy",+ displayName: "Lemmy Photo Resizer",+ description: "Resize icons and banners for Lemmy communities.",+ educationalContent: "Lemmy UI is similar to Reddit.",+ simpleIconSlug: "lemmy",+ colorHex: "000000",+ dimensions: [+ { label: "Community Icon", width: 256, height: 256, aspectRatio: 1, description: "Square icon." },+ { label: "Community Banner", width: 1000, height: 200, aspectRatio: 5, description: "Header image." },+ ],+ },+ slack: {+ id: "slack",+ name: "Slack",+ displayName: "Slack Photo Resizer",+ description: "Create perfect Slack profile photos and emojis.",+ educationalContent: "Slack avatars are small, so clarity is key.",+ simpleIconSlug: "slack",+ colorHex: "4A154B",+ dimensions: [+ {+ label: "Profile Picture",+ width: 512,+ height: 512,+ aspectRatio: 1,+ description: "Upload large, Slack scales it down.",+ },+ ],+ },+ medium: {+ id: "medium",+ name: "Medium",+ displayName: "Medium Photo Resizer",+ description: "Resize images for Medium articles and profiles.",+ educationalContent: "High quality hero images improve article engagement.",+ simpleIconSlug: "medium",+ colorHex: "000000",+ dimensions: [+ { label: "Profile Picture", width: 1000, height: 1000, aspectRatio: 1, description: "Circular avatar." },+ { label: "Background Image", width: 1500, height: 750, aspectRatio: 2, description: "Publication header." },+ ],+ },+ github: {+ id: "github",+ name: "GitHub",+ displayName: "GitHub Photo Resizer",+ description: "Resize images for GitHub profiles and social previews.",+ educationalContent: "Professional avatars build trust in open source.",+ simpleIconSlug: "github",+ colorHex: "181717",+ dimensions: [+ { label: "Profile Picture", width: 500, height: 500, aspectRatio: 1, description: "Square avatar." },+ { label: "Social Preview", width: 1280, height: 640, aspectRatio: 2, description: "Repo social card." },+ ],+ },+ warpcast: {+ id: "warpcast",+ name: "Warpcast",+ displayName: "Warpcast Photo Resizer",+ description: "Resize images for Farcaster/Warpcast profiles.",+ educationalContent: "Farcaster clients use standard dimensions.",+ simpleIconSlug: "farcaster",+ colorHex: "855DCD",+ dimensions: [{ label: "Profile Picture", width: 320, height: 320, aspectRatio: 1, description: "Avatar." }],+ },+};++export const imageResizerPlatformList = Object.values(imageResizerPlatformConfigs);diff --git a/docs/src/app/(home)/tools/components/image-resizer-utils.ts b/docs/src/app/(home)/tools/components/image-resizer-utils.tsnew file mode 100644index 000000000..0c93499a1--- /dev/null+++ b/docs/src/app/(home)/tools/components/image-resizer-utils.ts@@ -0,0 +1,93 @@+export const createImage = (url: string): Promise<HTMLImageElement> =>+ new Promise((resolve, reject) => {+ const image = new Image();+ image.addEventListener("load", () => resolve(image));+ image.addEventListener("error", error => reject(error));+ image.setAttribute("crossOrigin", "anonymous"); // needed to avoid CORS issues on CodeSandbox+ image.src = url;+ });++export function getRadianAngle(degreeValue: number) {+ return (degreeValue * Math.PI) / 180;+}++/**+ * Returns the new bounding area of a rotated rectangle.+ */+export function rotateSize(width: number, height: number, rotation: number) {+ const rotRad = getRadianAngle(rotation);++ return {+ width: Math.abs(Math.cos(rotRad) * width) + Math.abs(Math.sin(rotRad) * height),+ height: Math.abs(Math.sin(rotRad) * width) + Math.abs(Math.cos(rotRad) * height),+ };+}++/**+ * This function was adapted from the one in the ReadMe of https://github.com/DominicTobias/react-image-crop+ */+export default async function getCroppedImg(+ imageSrc: string,+ pixelCrop: { x: number; y: number; width: number; height: number },+ rotation = 0,+ flip = { horizontal: false, vertical: false },+ targetWidth?: number,+ targetHeight?: number+): Promise<string | null> {+ const image = await createImage(imageSrc);+ const canvas = document.createElement("canvas");+ const ctx = canvas.getContext("2d");++ if (!ctx) {+ return null;+ }++ const rotRad = getRadianAngle(rotation);++ // calculate bounding box of the rotated image+ const { width: bBoxWidth, height: bBoxHeight } = rotateSize(image.width, image.height, rotation);++ // set canvas size to match the bounding box+ canvas.width = bBoxWidth;+ canvas.height = bBoxHeight;++ // translate canvas context to a central location to allow rotating and flipping around the center+ ctx.translate(bBoxWidth / 2, bBoxHeight / 2);+ ctx.rotate(rotRad);+ ctx.scale(flip.horizontal ? -1 : 1, flip.vertical ? -1 : 1);+ ctx.translate(-image.width / 2, -image.height / 2);++ // draw rotated image+ ctx.drawImage(image, 0, 0);++ // croppedAreaPixels values are bounding box relative+ // extract the cropped image using these values+ const data = ctx.getImageData(pixelCrop.x, pixelCrop.y, pixelCrop.width, pixelCrop.height);++ // set canvas width to final desired crop size - this will clear existing context+ canvas.width = pixelCrop.width;+ canvas.height = pixelCrop.height;++ // paste generated rotate image at the top left corner+ ctx.putImageData(data, 0, 0);++ // If target dimensions are provided, resize the result+ if (targetWidth && targetHeight) {+ const resizedCanvas = document.createElement("canvas");+ resizedCanvas.width = targetWidth;+ resizedCanvas.height = targetHeight;+ const resizedCtx = resizedCanvas.getContext("2d");++ if (resizedCtx) {+ // High quality resize+ resizedCtx.imageSmoothingEnabled = true;+ resizedCtx.imageSmoothingQuality = "high";+ resizedCtx.drawImage(canvas, 0, 0, targetWidth, targetHeight);++ return resizedCanvas.toDataURL("image/jpeg");+ }+ }++ // As Base64 string+ return canvas.toDataURL("image/jpeg");+}diff --git a/docs/src/app/(home)/tools/page.tsx b/docs/src/app/(home)/tools/page.tsxindex 43be37370..771415054 100644--- a/docs/src/app/(home)/tools/page.tsx+++ b/docs/src/app/(home)/tools/page.tsx@@ -30,6 +30,7 @@ import { usernameGeneratorPlatformList } from "./components/username-generator-pimport { hashtagGeneratorPlatformList } from "./components/hashtag-generator-platform-configs";import { characterCounterPlatformList } from "./components/character-counter-platform-configs";import { bioGeneratorPlatformList } from "./components/bio-generator-platform-configs";+import { imageResizerPlatformList } from "./components/image-resizer-platform-configs";import {SiDiscord,SiX,@@ -300,6 +301,13 @@ const bioGeneratorTools = bioGeneratorPlatformList.map(platform => ({description: `Generate compelling ${platform.name} bios with AI.`,}));+const imageResizerTools = imageResizerPlatformList.map(platform => ({+ href: `/tools/${platform.id}-photo-resizer`,+ icon: platformIconMap[platform.id],+ title: platform.displayName,+ description: `Resize and crop images for ${platform.name} profiles, covers, and posts.`,+}));+const socialMediaTools = [...fontGeneratorTools,...commentGeneratorTools,@@ -309,6 +317,7 @@ const socialMediaTools = [...hashtagGeneratorTools,...characterCounterTools,...bioGeneratorTools,+ ...imageResizerTools,];function ToolCard({ tool }: { tool: { href: string; icon: any; title: string; description: string } }) {