Skip to content

faha1999/photo-card

Repository files navigation

πŸ“Έ Photo Card Generator

Create customizable photo cards with templates, filters, and adjustable image settings, perfect for social media posts, brand promotions, and eCommerce marketing.

πŸš€ Live Demo

Check out the live demo: Photo Card Generator

πŸŽ₯ Demo Preview

Demo PreviewPhoto Card Generator

Transform your product photos into stunning social media content with this powerful Next.js-based Photo Card Generator. Built for eCommerce businesses and digital marketers, this modern web application streamlines the creation of professional photo cards with customizable templates, advanced filters, and flexible export options. Whether you're managing an online store, running social media campaigns, or handling brand assets, this tool helps you create consistent, eye-catching visuals in seconds. Featuring real-time previews, smart image validation, and responsive design, it's the perfect solution for modern digital content creation.

Create professional social media photo cards for your eCommerce products in seconds

Next.js TypeScript TailwindCSS License: MIT

✨ Features

  • πŸ–ΌοΈ Custom template selection and management (PNG format)
  • πŸ“€ Smart file upload with validation:
    • Photos: JPG, JPEG, PNG formats
    • Templates: PNG format only
    • 10MB size limit with validation feedback
  • 🎨 Image adjustment controls:
    • Scale/resize
    • Brightness
    • Contrast
    • Grayscale
    • Sepia effects
  • πŸ“ Guide overlay for precise positioning
  • πŸ’Ύ Multiple export formats (PNG/JPEG)
  • πŸ“ Custom filename support
  • πŸ”„ Reset and adjustment capabilities
  • πŸ“± Responsive design with Tailwind CSS
  • πŸ” Real-time preview updates

Project Structure

β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ templates/        # Card template images
β”‚   β”‚   β”œβ”€β”€ logo.png
β”‚   β”‚   └── template.png
β”‚   └── video/           # Demo assets
β”‚       └── demo.gif     # Application demo
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/             # Next.js app directory
β”‚   β”‚   β”œβ”€β”€ Footer.tsx   # Footer component
β”‚   β”‚   β”œβ”€β”€ globals.css  # Global styles
β”‚   β”‚   β”œβ”€β”€ layout.tsx   # Root layout
β”‚   β”‚   └── page.tsx     # Home page
β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”œβ”€β”€ CardPreview.tsx    # Preview component
β”‚   β”‚   β”œβ”€β”€ Controls.tsx       # Image controls
β”‚   β”‚   β”œβ”€β”€ TemplateManager.tsx # Template management
β”‚   β”‚   └── UploadArea.tsx     # File upload area
β”‚   β”œβ”€β”€ types/          # TypeScript definitions
β”‚   β”‚   β”œβ”€β”€ css.d.ts    # CSS type definitions
β”‚   β”‚   └── index.ts    # Common type definitions
β”‚   └── utils/
β”‚       └── generateCard.ts    # Card generation logic
β”œβ”€β”€ next-env.d.ts       # Next.js TypeScript definitions
β”œβ”€β”€ next.config.mjs     # Next.js configuration
β”œβ”€β”€ package.json        # Project dependencies
β”œβ”€β”€ postcss.config.js   # PostCSS configuration
β”œβ”€β”€ tailwind.config.js  # Tailwind CSS configuration
└── tsconfig.json      # TypeScript configuration

Getting Started

  1. Clone the repository:

    git clone https://github.com/faha1999/photo-card.git
    cd photo-card
  2. Install dependencies:

    npm install
  3. Run the development server:

    npm run dev
  4. Open http://localhost:3000 with your browser to see the application.

πŸ› οΈ Tech Stack

Available Scripts

  • npm run dev - Starts the development server
  • npm run build - Builds the app for production
  • npm start - Runs the built app in production mode
  • npm run lint - Runs linting checks

🧩 Components

App Components (src/app/)

Footer.tsx

  • Renders the application footer
  • Contains project attribution and links
  • Responsive design with Tailwind CSS

Layout.tsx

  • Main application layout wrapper
  • Handles metadata and SEO settings
  • Manages global styles and fonts

Page.tsx

  • Main application page component
  • Orchestrates component composition
  • Manages global state and data flow

Feature Components (src/components/)

CardPreview.tsx

  • Renders real-time photo card preview
  • Implements HTML5 Canvas for image manipulation
  • Handles filters and effects (brightness, contrast, etc.)
  • Manages guide overlay for positioning
  • Provides real-time visual feedback
  • Supports touch interactions for mobile users

Controls.tsx

  • Image adjustment interface
  • Scale/resize controls with predefined options
  • Advanced filter controls:
    • Brightness and contrast sliders
    • Grayscale and sepia effects
    • Blend mode selection
  • Export format selection (PNG/JPEG)
  • Custom filename input
  • Guide overlay toggle
  • Reset functionality

TemplateManager.tsx

  • Template selection and management interface
  • Supports default and custom templates
  • PNG template upload functionality
  • Template preview with live updates
  • Template deletion and renaming features
  • Local storage integration for user templates
  • Drag-and-drop template switching

UploadArea.tsx

  • Smart file upload component
  • Drag-and-drop functionality
  • File type validation:
    • Photos: JPG, JPEG, PNG support
    • Templates: PNG only restriction
  • 10MB file size limit enforcement
  • Real-time validation feedback
  • User-friendly error messages
  • Progress and status indicators

οΏ½ Types (src/types/)

css.d.ts

  • TypeScript definitions for CSS modules
  • Style-related type declarations
  • Custom CSS property definitions

index.ts

  • Core type definitions
  • Interface declarations for:
    • Filter settings
    • Position coordinates
    • Card state management
    • Component props
    • Image generation options

πŸ› οΈ Utils (src/utils/)

generateCard.ts

  • Core image processing functionality
  • Advanced features:
    • Image scaling and positioning
    • Filter and effect application
    • Template overlay handling
    • Guide rendering system
    • Multiple export format support
    • Base64 conversion
    • Error handling
    • Performance optimizations

βš™οΈ Configuration Files

next.config.mjs

  • Next.js framework configuration
  • Image optimization settings
  • Build and deployment options

tailwind.config.js

  • Tailwind CSS customization
  • Theme and color palette settings
  • Responsive breakpoints
  • Custom plugin configuration

tsconfig.json

  • TypeScript compiler options
  • Path aliases and module resolution
  • Strict type checking settings
  • Build optimization rules

🀝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create your feature branch:
    git checkout -b feature/AmazingFeature
  3. Commit your changes:
    git commit -m 'Add some AmazingFeature'
  4. Push to the branch:
    git push origin feature/AmazingFeature
  5. Open a Pull Request

Please ensure your PR adheres to the following:

  • Follows the existing code style
  • Includes appropriate tests if applicable
  • Updates documentation as needed
  • Maintains TypeScript type safety

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘€ Contact

Kawsar Ahmed Fahad

🌟 Show your support

Give a ⭐️ if this project helped you!

About

Create customizable photo cards with templates, filters, and adjustable image settings, perfect for social media posts, brand promotions, and eCommerce marketing.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors