A lightweight web application to extract all image URLs from a given website and display them in a dynamic, responsive gallery with infinite scrolling and several UX features.
- Frontend: React (Vite)
- Backend: Netlify Function (Node.js + Cheerio) for scraping
- Styling: Custom CSS
- Deployment: Netlify (single
netlify.tomlconfiguration)
- Extract Image URLs: User inputs a website URL, Netlify Function fetches HTML, parses with Cheerio, extracts
<img>src,data-src, andsrcsetURLs, resolves relative paths, and returns as JSON. - Dynamic Gallery: Responsive grid, adjustable columns (1-5), lazy-loading (
loading="lazy"), image counter. - Infinite Scrolling: Loads images incrementally (20 per batch) using
IntersectionObserver. - Dark / Light Mode Toggle: Theme switcher using CSS variables, persists in
localStorage. - Fullscreen Viewer: Clicking an image opens it in fullscreen/lightbox mode with keyboard navigation (left/right arrows) and close button.
- Filter by File Type: Checkboxes to filter images by file extension (client-side).
- Image Counter: Shows visible vs total extracted images.
-
Clone the repository:
git clone https://github.com/your-username/web-image-gallery.git cd web-image-gallery -
Install frontend dependencies:
npm install
-
Install Netlify Function dependencies:
cd netlify/functions npm install cd ../..
-
Run the development server:
npm run dev
The app will be available at
http://localhost:5173/. -
To test Netlify Functions locally: You'll need the Netlify CLI.
npm install netlify-cli -g netlify dev
This will start a local server that proxies requests to your Netlify Functions. The app will typically be available at
http://localhost:8888/.
- Ensure you have a Netlify account.
- Install Netlify CLI (if not already installed):
npm install netlify-cli -g
- Login to Netlify:
netlify login
- Initialize a new Netlify project (if not already linked):
Follow the prompts. Netlify will detect the
netlify init
netlify.tomlfile and suggest appropriate build settings.- Build command:
npm run build - Publish directory:
dist - Functions directory:
netlify/functions
- Build command:
- Deploy manually (for testing):
Or, connect your Git repository (GitHub, GitLab, Bitbucket) to Netlify for continuous deployment. Netlify will automatically build and deploy your site on every push to your main branch.
netlify deploy --prod
.
├── public/
├── src/
│ ├── assets/
│ ├── components/ (if needed for more complex components)
│ ├── App.jsx
│ ├── index.css
│ ├── main.jsx
│ └── styles.css
├── netlify/
│ └── functions/
│ └── extract-images.js
├── .gitignore
├── index.html
├── netlify.toml
├── package.json
├── vite.config.js
└── README.md