Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
6f5ea99
Remove unnecessary rxjs imports
markuseckstein Feb 6, 2017
fc6142b
Merge pull request #21 from markuseckstein/master
Feb 6, 2017
f14424b
added support for multiple galleries. If gallery name is not provided…
Mar 6, 2017
a126cb0
removed unneeded log
victooor Mar 6, 2017
cdb6011
spelling correction
victooor Mar 6, 2017
83322d2
Merge pull request #24 from victooor/master
Mar 7, 2017
f39422c
update to version 0.6.0
Mar 7, 2017
3e93c86
Update README.md
Mar 23, 2017
fa2fcaf
#27: reload images if gallery name changed
Mar 24, 2017
c0d7b70
Merge branch 'master' of https://github.com/victooor/angular2-image-g…
Mar 25, 2017
0990329
Merge branch 'victooor-master'
Mar 25, 2017
87460e7
remove console warnings from material2
Mar 25, 2017
c6ed578
check if image is supported by graphicsmagick rather than blacklist e…
Mar 25, 2017
b505def
bump version
Mar 25, 2017
cfd95fb
move angular dependencies to peerdependencies for making it work with…
Mar 26, 2017
6225606
version bump
Mar 26, 2017
226ab52
Update README.md
Mar 26, 2017
e381479
update current images observable when opening viewer
tomteman Apr 2, 2017
7178162
update from angular-cli beta.24 to 1.0.0
Apr 5, 2017
7e27095
make all gallery properties public
Apr 5, 2017
5a1d734
update travis to use new angular cli
Apr 5, 2017
0e8d163
more travis changes
Apr 5, 2017
a592ffc
remove node_modules from travis cache
Apr 5, 2017
5a461a2
fix library creation to use NGC rather than TSC to be angular-cli >1.…
Apr 10, 2017
5283f88
add tsconfig for ngc
Apr 10, 2017
c8f6966
Update README.md
Apr 10, 2017
6946131
add travis back in
Apr 10, 2017
0be39bc
Merge branch 'master' of https://github.com/BenjaminBrandmeier/angula…
Apr 10, 2017
678bd01
remove angular 2 dependencies from readme
Apr 10, 2017
fc3b6bb
Merge branch 'master' into pr/multiple-galleries-viewer
tomteman Apr 11, 2017
7055e71
on lib creation make an ES5 module since UglifyJS has issues with ES2015
Apr 14, 2017
9db020a
Merge pull request #37 from tomteman/pr/multiple-galleries-viewer
Apr 14, 2017
854cbb7
bump version to 0.7.2
Apr 14, 2017
1280f5d
replace BrowserModule with CommonsModule. #35
Apr 14, 2017
e44e68b
updated polyfills and update readme regarding browser compatibility
Apr 14, 2017
94d7b21
Readd licence file.
Apr 18, 2017
489fa19
Add BrowserStack badge for automated protractor tests
Apr 21, 2017
830d974
add six protractor tests for e2e testing. #29
Apr 21, 2017
76f881e
run e2e inside travis
Apr 21, 2017
08b9376
feed library inside travis with test images
Apr 21, 2017
120f638
use angular cli from installed npm. build project with prod and uat f…
Apr 21, 2017
a9b7644
use relative paths
Apr 21, 2017
6183411
cache node_modules inside travis
Apr 21, 2017
3d30cc9
use browserstack inside travis ci for e2e tests with protractor (1)
Apr 21, 2017
6913dcb
use browserstack inside travis ci for e2e tests with protractor (2)
Apr 21, 2017
61d82ef
use browserstack inside travis ci for e2e tests with protractor (3)
Apr 21, 2017
0a1e06b
use browserstack inside travis ci for e2e tests with protractor (4)
Apr 21, 2017
d2be9d4
use browserstack inside travis ci for e2e tests with protractor (5)
Apr 21, 2017
2ddcc64
use browserstack inside travis ci for e2e tests with protractor (6)
Apr 21, 2017
93eb068
use browserstack inside travis ci for e2e tests with protractor (7)
Apr 21, 2017
859384c
use browserstack inside travis ci for e2e tests with protractor (8)
Apr 21, 2017
85623af
update browserstack badge
Apr 21, 2017
a63dba8
break one test to see browserstack ci behaviour
Apr 21, 2017
a1b785c
Merge branch 'master' of https://github.com/BenjaminBrandmeier/angula…
Apr 21, 2017
c0f583e
set browserstack session status after success inside travis
Apr 22, 2017
4386f4c
set browserstack session status after failure inside travis
Apr 22, 2017
d89c6ca
redo failing e2e test
Apr 22, 2017
a6b1a21
extend browserstack e2e setup to run against local, inside travis and…
Apr 22, 2017
953de1d
adjust spec location after config move
Apr 22, 2017
1b0e5fa
prepare for multiple browser use with browserstack
Apr 22, 2017
f9ea804
rollback to old approach since authorization doesn't work with common…
Apr 22, 2017
48f6142
remove library module since it's not used anymore with ngc approach
Apr 22, 2017
81703a8
semicolon cleanup
Apr 23, 2017
4662477
enable fetching images and metadata from external data sources. #33
Apr 23, 2017
dbcff4a
show verbose error if metadata fetch does not work correctly #33
Apr 23, 2017
2ad9bc8
add chapter for creating your own JSON
Apr 24, 2017
9ed6e06
update documentation to describe providing your own metadata JSON
Apr 24, 2017
16eb087
adjust style of docs
Apr 24, 2017
9ed3228
adjust style of docs
Apr 24, 2017
f13565b
Remove extra '^' from platform-browser-dynamic
racedale Apr 24, 2017
3ada0ff
Merge pull request #43 from racedale/patch-1
Apr 24, 2017
522b5ba
Changed indexOf in file ext check to lastIndexOf
Roundaround Jan 6, 2018
182fe0a
Merge pull request #65 from Roundaround/master
BenjaminBrandmeier Jun 9, 2018
75e0482
Auto orient images based on EXIF metadata. This fixes #64
BenjaminBrandmeier Jun 9, 2018
6f2893c
Provide basic pagination functionality.
BenjaminBrandmeier Jun 9, 2018
967b5ff
ts linting
BenjaminBrandmeier Jun 9, 2018
491cfe0
migrate to angular cli 6.0.8 for compatibility preparation of angular…
BenjaminBrandmeier Jun 12, 2018
9e91384
bring back config files
BenjaminBrandmeier Jun 16, 2018
656f2c0
linting
BenjaminBrandmeier Jun 16, 2018
9bae7e1
bring back original e2e tests
BenjaminBrandmeier Jun 16, 2018
797c4c5
final preparation for angular 6 publication
BenjaminBrandmeier Jun 17, 2018
9817f85
provide readme.md for library on npm
BenjaminBrandmeier Jun 17, 2018
a2d6f96
bring back ci config
BenjaminBrandmeier Jun 17, 2018
5852425
set zindex to prevent navbar issues with bootstrap
BenjaminBrandmeier Jun 17, 2018
4f462ab
fix ci
BenjaminBrandmeier Jun 17, 2018
0cfefac
fix ci
BenjaminBrandmeier Jun 17, 2018
8abacd3
fix ci
BenjaminBrandmeier Jun 17, 2018
5c585c9
fix issue when multiple galleries are used and 0 is the gallery name
BenjaminBrandmeier Jun 23, 2018
55ce3fc
allow galleries with gName 0
BenjaminBrandmeier Jun 24, 2018
36c4e95
add peer dependencies for conversion
BenjaminBrandmeier Jun 24, 2018
4c387c7
update to angular 7
BenjaminBrandmeier Jan 5, 2019
7b5e635
replace angular material inside demo with sliders, point to new demo …
BenjaminBrandmeier Jan 20, 2019
c39f0f0
upgrade to angular 8.1
BenjaminBrandmeier Jul 13, 2019
9308565
bring dependencies up to date
BenjaminBrandmeier Jul 13, 2019
b0d73a8
allow special characters in file names and bypass security trust styles
apixandru Mar 18, 2020
997fbe2
remove unnecessary imports
apixandru Mar 18, 2020
8a872f9
Merge pull request #88 from apixandru/issue/32
BenjaminBrandmeier Sep 10, 2022
9fa7d3a
Merge pull request #87 from apixandru/issues/44
BenjaminBrandmeier Sep 10, 2022
e686592
migrate to angular 14
BenjaminBrandmeier Sep 10, 2022
dfdefd3
replace deprecated slider and resolve some warnings when starting dem…
BenjaminBrandmeier Sep 14, 2022
0670c9a
introduce prettier
BenjaminBrandmeier Sep 14, 2022
4e37ac0
hammer.js has to be imported as a module to work
BenjaminBrandmeier Sep 14, 2022
0073b7b
prepare new release
BenjaminBrandmeier Sep 14, 2022
c677052
Thanks to @Dan-Lit. This resolves #106.
BenjaminBrandmeier Sep 14, 2022
c290b6d
improve setup
BenjaminBrandmeier Sep 14, 2022
de94c70
prepare js->ts refactoring for convert script
BenjaminBrandmeier Jan 8, 2023
9c4bfd2
improve handling of scripts. improve message output.
BenjaminBrandmeier Jan 13, 2023
b29264b
refactor convert script
BenjaminBrandmeier Jan 14, 2023
14aa182
make console output real smooth
BenjaminBrandmeier Jan 15, 2023
501d6d7
14.1 release
BenjaminBrandmeier Jan 15, 2023
839cc71
add basic typing
BenjaminBrandmeier Jan 16, 2023
ed03a3d
renaming
BenjaminBrandmeier Jan 21, 2023
07e46cb
increase readability and performance of gallery component
BenjaminBrandmeier Jan 21, 2023
5140098
upgrade to angular 15
BenjaminBrandmeier Jan 21, 2023
775f935
npm audit fix
BenjaminBrandmeier Jan 28, 2023
49f9eaa
update sub-deps
BenjaminBrandmeier Jan 29, 2023
713f213
Update README.md
BenjaminBrandmeier Mar 23, 2023
9441603
add optional parameter [includeViewer] to support use cases where vie…
BenjaminBrandmeier Apr 8, 2023
779f96d
Add optional parameter **[lazyLoadGalleryImages]** to turn off lazy l…
BenjaminBrandmeier Apr 8, 2023
9d4ad0d
migrate to angular 16
BenjaminBrandmeier Nov 26, 2023
ac10b4c
migrate to angular 17
BenjaminBrandmeier Nov 26, 2023
17658dc
migrate to angular 18
BenjaminBrandmeier Aug 8, 2024
aeb8bc1
migrate to angular 19
BenjaminBrandmeier Mar 30, 2025
9833e55
migrate to angular 20
BenjaminBrandmeier Oct 1, 2025
fbe9447
fix broken release
BenjaminBrandmeier Nov 14, 2025
565d21d
add CLAUDE.md
BenjaminBrandmeier Feb 7, 2026
dbc98b9
migrate to angular 21
BenjaminBrandmeier Feb 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 140

[*.md]
max_line_length = off
trim_trailing_whitespace = false
52 changes: 5 additions & 47 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,50 +1,8 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/publish
/src/app/*.js
/src/app/demo/*.js
/src/app/gallery/*.js
/src/app/services/*.js
/src/app/viewer/*.js

# dependencies
/node_modules
tools/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
/typings
upload-temp.sh
upload-prod.sh

# e2e
/e2e/*.js
/e2e/*.map

#System Files
.DS_Store
Thumbs.db
images_to_convert/
/projects/angular2-image-gallery/node_modules
.angular
/tmp
/backup
/scripts/build
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/dist
/node_modules
/.idea
/projects/angular2-image-gallery/node_modules
.angular
11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"semi": false,
"bracketSpacing": true,
"arrowParens": "always",
"trailingComma": "es5",
"bracketSameLine": true,
"printWidth": 140
}
22 changes: 16 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,29 @@ sudo: false
cache:
directories:
- node
- node_modules
dist: trusty
node_js:
- '7.3.0'
- '8.9.4'
branches:
only:
- master
- master
before_install:
- npm install -g angular-cli
- npm install @angular/cli
- npm run lib
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script:
- ng build --prod
- npm run build
- npm run e2e
notifications:
webhooks:
on_success: always
on_failure: always
on_start: false
on_start: false
addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
47 changes: 47 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Monorepo containing an Angular 21 responsive image gallery library (`angular2-image-gallery`) and its demo application. The library is published to npm and handles high-resolution image display with multi-resolution support.

## Commands

- **Dev server**: `npm start` (or `npm run start-net` for network access)
- **Build library**: `npm run lib` (builds via ng-packagr, copies convert script and README to dist)
- **Build demo app**: `npm run build`
- **Run tests**: `npm test`
- **Lint**: `npm run lint`
- **E2E tests**: `npm run e2e`

The demo app depends on the built library (`"angular2-image-gallery": "file:dist/angular2-image-gallery"`), so you must run `npm run lib` before `npm start` if the library hasn't been built yet.

## Architecture

### Two-project structure

- **`projects/angular2-image-gallery/`** - The reusable library (built with ng-packagr)
- `gallery/` - Grid layout component with responsive row-based image arrangement
- `viewer/` - Full-screen image viewer with keyboard/touch navigation and quality selection
- `services/image.service.ts` - RxJS Subject-based state management (image list, selected index, viewer visibility)
- `data/image-metadata.ts` - TypeScript type for image metadata
- Public API exported via `public_api.ts`

- **`src/app/`** - Demo application consuming the library
- `demo.component.ts` - Showcases gallery with interactive sliders for configuration

### Image processing pipeline

`scripts/build/convert.js` uses GraphicsMagick to generate 7 resolution variants (375px to original) from source images, producing a `data.json` metadata file in `assets/img/gallery/`. The viewer dynamically selects resolution based on screen size.

### Key patterns

- tsconfig `paths` alias `angular2-image-gallery` to `dist/angular2-image-gallery` so the demo app imports from the built library output
- Components use `standalone: false` with `Angular2ImageGalleryModule`
- Touch gestures require `hammerjs` (imported globally)
- Observable streams use `$` suffix convention

## Code Style

Prettier enforced: 2-space indent, single quotes, no semicolons, 140 char line width, trailing commas (es5), `bracketSameLine: true`.
21 changes: 21 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Benjamin Brandmeier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
150 changes: 103 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,149 @@
# Angular 2 Image Gallery
[![Build Status](https://travis-ci.org/BenjaminBrandmeier/angular2-image-gallery.svg?branch=master)](https://travis-ci.org/BenjaminBrandmeier/angular2-image-gallery)
[![npm version](https://badge.fury.io/js/angular2-image-gallery.svg)](https://badge.fury.io/js/angular2-image-gallery)
[![npm downloads](https://img.shields.io/npm/dt/angular2-image-gallery.svg)](https://www.npmjs.com/package/angular2-image-gallery)

A responsive image gallery designed for high resolution images.
[![npm version](https://img.shields.io/npm/v/angular2-image-gallery?style=for-the-badge)](https://img.shields.io/npm/v/angular2-image-gallery?style=for-the-badge)
[![npm downloads](https://img.shields.io/npm/dm/angular2-image-gallery?style=for-the-badge)](https://www.npmjs.com/package/angular2-image-gallery)

The project consists of a gallery, a viewer and a script for image preparation.
----> **compatible with Angular 21 (and older versions)** <----

Before using the gallery, you have to process all of your images that will be part of your gallery with the node.js script. The processed images will be stored to your applications assets. During runtime everything runs client-side and there is no separate server-side communication involved. The viewer takes care that an optimal image quality is served based on the device resolution.
Responsive image gallery designed for high resolution images.

The project consists of a gallery (+ viewer) and a script for image preparation.

## Demo

http://oidamo.de/angular2-image-gallery/
[https://oidamo.de/blog/gallery-demo](https://oidamo.de/blog/gallery-demo)

## How to use the gallery in your project
### Pre-requirements
Install **node (>= 4.2.2)** and **graphicsmagick**: http://www.graphicsmagick.org/README.html#installation
### Fundamentals

### Embed in your project
Before Using the gallery, you have to process all of your images with the **convert** script.

#### 1. Install angular2-image-gallery
The processed images will be stored to your applications assets.

```bash
npm install angular2-image-gallery --save
```
The viewer takes care of an optimal image quality being served based on the users screen resolution.

#### 2. Import angular2-image-gallery in your Angular 2 module
### Installation

```javascript
imports: [
BrowserModule,
FormsModule,
HttpModule,
Angular2ImageGalleryModule <-----
],
```
#### 1. Install graphicsmagick

#### 3. Import scripts (when using angular-cli add these lines in polyfills.ts)
Follow the instructions: [http://www.graphicsmagick.org/README.html#installation](http://www.graphicsmagick.org/README.html#installation)

```javascript
import 'web-animations-js/web-animations.min';
import 'hammerjs/hammer';
#### 2. Install dependencies

```bash
npm install angular2-image-gallery hammerjs --save
```

#### 4. Import styles (when using angular-cli add this line in styles.css)
#### 3. Import modules

```javascript
@import '~@angular/material/core/theming/prebuilt/deeppurple-amber.css';
@import '~https://fonts.googleapis.com/icon?family=Material+Icons';
imports: [
...,
Angular2ImageGalleryModule,
HammerModule
],
```

#### 5. Run convert script
#### 4. Run convert script

```bash
node node_modules/angular2-image-gallery/convert.js <path/to/your/images>
```

Add a flag to define the order of the images inside the gallery

`-n` sort by file name (default)

`-d` sort chronologically by the original creation time (e.g. for coverages of a wedding)
`-d` sort chronologically by the original creation time

`-c` sort by primary image color

#### 6. Embed gallery in your template
Additional optional parameter to support multiple galleries. Add it if you want to put your images into a separate gallery.

`--gName=yourGalleryName`

#### 5. Embed gallery in your template

```javascript
<gallery
[flexBorderSize]="3"
[flexImageSize]="7"
(viewerChange)="yourNotificationFunction($event)">
</gallery>
<gallery
[flexBorderSize]="3"
[flexImageSize]="7"
[galleryName]="'yourGalleryName'"
[maxRowsPerPage]="100"
(viewerChange)="yourNotificationFunction($event)"
[includeViewer]="true"
[lazyLoadGalleryImages]="true"
></gallery>
```

All parameters are optional. You may play around on the demo site to find out what parameters suit your needs.
All parameters are optional.

The viewerChange event notifies you when the viewer component gets opened or closed.
* **[flexBorderSize]** used to define the border thickness between the images within the gallery.
* **[flexImageSize]** used to define the size of the images with the gallery (not the viewer).
* **[galleryName]** used when having multiple galleries.
* **[maxRowsPerPage]** maximum rows per gallery, this will add navigation arrows once the threshold is reached.
* **[viewerChange]** event fires once the viewer component gets opened or closed.
* **[includeViewer]** provides an option to manually place the viewer outside the default DOM structure. Defaults to true.
* **[lazyLoadGalleryImages]** allows to disable lazy loading of gallery images. All images will be loaded at once when set to false. Defaults to true.

That's it, start your application and have a look!
## Different use cases
### Fetching images from an external data source

## Currently used tools
Fetching your images from an external data source: [CLICK HERE](https://github.com/BenjaminBrandmeier/angular2-image-gallery/blob/master/docs/externalDataSource.md)

- Angular 2.3.1
- NodeJS 7.3.0
- Angular-CLI 1.0.0-beta.24
- graphicsmagick
### I don't want to use the convert script and provide my own metadata JSON

This is possible, but not the intent of this project. Please [CLICK HERE](https://github.com/BenjaminBrandmeier/angular2-image-gallery/blob/master/docs/ownJSON.md)

## Troubleshooting

If the conversion process fails, make sure you have enough swap space provided.

If you experience any other issues, please raise an issue on GitHub.

## Changelog

### 21.0.0

* Angular 21 support

### 20.0.0

* Angular 20 support

### 19.0.0

* Angular 19 support

### 18.0.0

* Angular 18 support

### 17.0.0

* Angular 17 support

### 16.0.0

* Angular 16 support

### 15.2.0

* Adding optional parameter **[lazyLoadGalleryImages]** to turn off lazy loading when set to false and instead load all gallery images at once.

### 15.1.0

* Adding optional parameter [includeViewer] to support use cases where viewer is placed outside the gallery component manually

### 15.0.0

* Angular 15 support
* Performance improvements

### 14.1.0

* Refactor convert script entirely
* Provide smoother output for image conversion process

### 14.0.0

* Angular 14 support
Loading