A dynamic, fast, and intuitive online gallery featuring a vast collection of royalty-free images with powerful search functionality and one-click download capabilities.
Live Demo β’ Repository β’ GitHub Profile
- About
- Features
- Technology Stack
- Project Structure
- Installation & Setup
- Usage Guide
- API Integration
- File Descriptions
- Browser Support
- Contributing
- Author
Fexels is a dynamic online gallery web application that brings users a seamless experience for discovering, previewing, and downloading royalty-free images. With an intuitive search bar, responsive design, and instant download features, Fexels makes it easy to find and access high-quality images by theme or keyword.
Built with vanilla HTML, CSS, and JavaScript, Fexels leverages the powerful Pexels API to deliver a constantly updated collection of premium-quality royalty-free images directly to users.
- π Advanced Search - Real-time search functionality to find images by theme, keyword, or photographer
- π± Responsive Design - Fully optimized for desktop, tablet, and mobile devices
- πΌοΈ Dynamic Gallery - Masonry/column layout that adapts to screen size
- ποΈ Image Preview - Lightbox modal with full-size image preview and photographer credits
- β¬οΈ One-Click Download - Instant download of high-quality royalty-free images
- βΎοΈ Infinite Scroll - "Load More" pagination for seamless browsing
- β‘ Fast Performance - Lightweight vanilla JavaScript with no unnecessary dependencies
- π¨ Beautiful UI - Modern, clean interface with smooth animations and transitions
- π·οΈ Photographer Attribution - Display photographer information for each image
- π‘ Real-time API Integration - Access to Pexels' constantly updated image database
| Technology | Purpose | Details |
|---|---|---|
| HTML5 | Structure | Semantic markup, accessibility, PWA manifest support |
| CSS3 | Styling | Responsive design, animations, flexbox, media queries, custom fonts |
| JavaScript (Vanilla) | Functionality | DOM manipulation, API calls, event handling, no frameworks |
| Pexels API | Image Data | RESTful API for fetching royalty-free images |
| Font Awesome 6.7.2 | Icons | Icon library for UI elements |
| Poppins Font | Typography | Modern, clean typeface via @font-face |
Language Composition:
- CSS: 61.3%
- JavaScript: 24.6%
- HTML: 14.1%
fexels/
βββ index.html # Main HTML file
βββ css/
β βββ style.css # Main stylesheet
β βββ fonts.css # Custom font definitions
β βββ font-awesome-6.7.2/ # Font Awesome icons library
β βββ fonts-poppins/ # Poppins font files
βββ js/
β βββ script.js # Main JavaScript functionality
βββ images/
β βββ favicon-images/ # Favicon assets
β βββ search-img.jpg # Hero section image
β βββ search-img_01.jpeg # Alternative hero images
β βββ search-img_02.jpeg
β βββ search-img_03.jpeg
βββ .gitignore # Git ignore rules
βββ fexels.site.webmanifest # PWA manifest file
- A modern web browser (Chrome, Firefox, Safari, Edge)
- Internet connection for API calls
- No server setup required - runs entirely on the client-side
-
Clone the Repository
git clone https://github.com/fhermas22/fexels.git cd fexels -
Open in Browser
- Option 1: Double-click
index.htmlto open locally - Option 2: Use a local server (recommended):
# Using Python 3 python -m http.server 8000 # Using Python 2 python -m SimpleHTTPServer 8000 # Using Node.js (with http-server) npx http-server
- Option 1: Double-click
-
Access the Application
- Local:
http://localhost:8000 - Live: https://fhermas22.github.io/fexels-images-gallery/
- Local:
- The gallery loads with 15 curated images by default on page load
- Hover over any image to see the photographer's name and download button
- Click "Load More" button to fetch the next set of images
- The gallery uses lazy-loading for optimal performance
- Type your search query in the search box (e.g., "nature", "mountain", "city")
- Press Enter to execute the search
- The gallery reloads with images matching your search term
- Continue clicking "Load More" to explore more results
- Clear the search box and press Enter to return to curated images
- Click on any image to open the lightbox modal
- View the full-resolution image with photographer information
- The image is displayed at maximum size while maintaining aspect ratio
- Click the Download Button (blue icon) to download
- Click the Close Button (gray icon) or outside the modal to close
- Open image preview by clicking on the image
- Click the Download Button in the lightbox header
- The image downloads to your default downloads folder
- Filename is the timestamp of download (milliseconds)
- All images are royalty-free and safe to use
- Base URL:
https://api.pexels.com/v1/ - Authentication: Bearer token in Authorization header
- Rate Limit: 200 requests per hour for free tier
GET https://api.pexels.com/v1/curated?page={page}&per_page={perPage}
Headers: { Authorization: API_KEY }
Response: { photos: [...], page, per_page, total_results, next_page }
GET https://api.pexels.com/v1/search?query={searchTerm}&page={page}&per_page={perPage}
Headers: { Authorization: API_KEY }
Response: { photos: [...], page, per_page, total_results, next_page }
{
id: 123456,
photographer: "John Doe",
avg_color: "#FF5733",
src: {
original: "https://...",
large2x: "https://...", // Used in Fexels
large: "https://...",
medium: "https://...",
small: "https://...",
portrait: "https://...",
landscape: "https://...",
tiny: "https://..."
}
}- Purpose: Main HTML structure
- Sections:
- Lightbox modal for image preview
- Search section with hero image and search input
- Gallery section with image list and load-more button
- Key Elements:
- Favicon support (multiple sizes)
- PWA manifest link
- CSS and JS imports
- Semantic HTML5 structure
- Size: ~5KB
- Features:
- Responsive grid layout using CSS columns
- Hover effects and smooth transitions
- Masonry gallery design
- Media queries for mobile (768px, 425px, 320px)
- Lightbox styling with backdrop blur effect
- Button and input styling
- Gradient overlays for image details
- Color Scheme:
- Primary:
#6a5cff(purple) - Secondary:
#6c757d(gray) - Text: White,
#333,#8d8d8d
- Primary:
- Size: ~3.8KB
- Core Functions:
getImages(apiURL)- Fetches images from Pexels APIgenerateHTML(images)- Dynamically creates gallery cardsloadMoreImages()- Handles paginationloadSearchImages(e)- Handles search with Enter keyshowLightBox(name, img)- Opens image preview modalhideLightbox()- Closes image previewdownloadImg(imgURL)- Downloads image to device
- Variables:
apiKey- Pexels API authentication tokenperPage- Number of images per request (15)currentPage- Current pagination pagesearchTerm- Current search query
- Event Listeners:
- Load More button click
- Search input key press (Enter)
- Close button click
- Download button click
- Purpose: Custom Poppins font definitions
- Weights Included: Thin, ExtraLight, Light, Normal, Medium, SemiBold, Bold, ExtraBold, Black
- Styles: Normal and Italic
- Format: WOFF and WOFF2 for best browser support
- Purpose: Progressive Web App configuration
- Features:
- App name: "Fexels Images Gallery"
- Standalone display mode
- App icons (192px, 512px)
- Theme and background colors
| Browser | Support | Notes |
|---|---|---|
| Chrome | β Full | Latest versions |
| Firefox | β Full | Latest versions |
| Safari | β Full | Latest versions |
| Edge | β Full | Latest versions |
| Opera | β Full | Latest versions |
| IE 11 | No fetch API or async/await |
Requirements:
- ES6 JavaScript support (Fetch API, Arrow Functions)
- CSS3 support (Flexbox, Media Queries, Transforms)
- Modern DOM APIs
Contributions are welcome! To contribute to Fexels:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request with detailed description
- Use vanilla JavaScript (no frameworks)
- Keep code clean and well-commented
- Maintain responsive design compatibility
- Test across different screen sizes
- Follow existing code style
Created by @fhermas22
Project Repository: github.com/fhermas22/fexels
Live Demo: fexels-images-gallery
This project is open source and available under the MIT License. Feel free to use, modify, and distribute this project.
β If you found this project helpful, please consider giving it a star!
Made with β€οΈ by @fhermas22