Photo with Frame is a React-based web application for enhancing your photographs with professional-looking frames, captions, and EXIF data display. Perfect for photographers, social media creators, and anyone looking to showcase their images with style.
- Image Upload: Drag-and-drop or file picker interface
- Custom Framing: Adjustable frames with background blur effects
- EXIF Data Display: Show camera settings, lens info, and other metadata
- Custom Captions: Add stylized text with multiple font options
- Image Export: Copy to clipboard or save to disk
- Responsive Design: Works on desktop and mobile devices
- Dark/Light Mode: Theme toggling for different viewing preferences
The application follows a modular, service-oriented architecture for better maintainability, testability, and scalability.
| Service | Description |
|---|---|
| FontLoader | Manages loading and caching of custom fonts |
| ImageService | Handles image loading and EXIF extraction |
| ImageDrawer | Canvas drawing operations for rendering images |
| ImageExporter | Image export functions (copy, save) |
| Hook | Purpose |
|---|---|
| useCanvas | Canvas management and context operations |
| useImageProcessor | Image handling workflow |
| useDragAndDrop | Drag and drop functionality |
| useCalculatedCanvasDimensions | Dynamic calculation of canvas dimensions based on settings |
- CanvasHolder: Main component for displaying and interacting with images
- SettingsPanel: Controls for adjusting image properties and display options
- SettingsActions: Action buttons for operations like save, copy, and reset
- ThemeToggle: Component for switching between light and dark themes
| Utility | Function |
|---|---|
| calcObjectFill | Functions for calculating object dimensions (contain/cover) |
| drawFunctions | Canvas drawing primitives for image rendering |
| textWidth | Text measurement and positioning utilities |
| fractions | Conversion of decimal numbers to readable fractions for EXIF display |
Photo with Frame follows several key design principles:
-
Separation of Concerns
- UI components are separated from business logic
- Image processing is handled by dedicated services
- State management is centralized in context providers
-
Declarative Programming
- Components define what should happen rather than how
- Side effects are isolated in hooks and effect handlers
- Pure functions are used where possible for predictability
-
Progressive Enhancement
- Core functionality works with minimal dependencies
- Advanced features gracefully degrade when not supported
- Performance optimizations are implemented strategically
-
Responsive and Accessible Design
- The interface adapts to different screen sizes
- Keyboard navigation is supported for accessibility
- Color contrast meets WCAG guidelines
The application follows a unidirectional data flow pattern:
- User interactions trigger events in components
- Components call hook methods to handle these events
- Hooks use services to perform operations
- Services return results to hooks
- Hooks update state
- Components re-render based on the new state
State is managed at different levels:
- Local Component State: For UI-specific state that doesn't affect other components
- Custom Hook State: For domain-specific state that might be shared across multiple components
- Context API: For global state that needs to be accessed throughout the application
- User uploads an image via drag-and-drop or file picker
- Image is loaded and EXIF data is extracted
- Canvas is initialized with appropriate dimensions
- Background is drawn with blur effect
- Overlay is applied for contrast
- Foreground image is drawn with border radius
- EXIF data and captions are rendered
- User can adjust settings and see real-time updates
- Final image can be exported via clipboard or saved as a file
- Canvas Redraw Optimization: Canvas is only redrawn when necessary
- Font Caching: Fonts are loaded once and cached for reuse
- Memoization: React's useMemo and useCallback are used to prevent unnecessary re-renders
- Lazy Loading: Components and resources are loaded only when needed
The application implements several security best practices:
- Content Security Policy: Restricts the sources from which content can be loaded
- Secure Font Loading: Fonts are loaded from trusted sources
- Local Processing: All image processing happens locally in the browser, no data is sent to servers
- Node.js (v14 or higher)
- npm or yarn
# Clone the repository
git clone https://github.com/yourusername/photo-with-frame.git
# Navigate to the project directory
cd photo-with-frame
# Install dependencies
npm install
# or
yarn install
# Start the development server
npm run dev
# or
yarn devFor more detailed documentation, please refer to the following resources in the docs folder:
- Architecture Documentation: Detailed overview of the application architecture, design decisions, and technical implementation.
- Changelog: Comprehensive documentation of all changes made in the recent development branch.
This project is licensed under the MIT License - see the LICENSE file for details.