Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 3 additions & 4 deletions app/pages/gallery/gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
</ion-navbar>
</ion-header>


<ion-content>
<ion-grid>
<ion-row *ngFor="let row of rows">
<ion-row *ngFor="let row of grid">
<ion-col width-50 *ngFor="let file_uri of row">
<img src="{{file_uri}}" />
<img src="{{file_uri}}" />
</ion-col>
</ion-row>
</ion-grid>
</ion-grid>
</ion-content>
18 changes: 10 additions & 8 deletions app/pages/gallery/gallery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,29 @@ import { NavController, NavParams } from 'ionic-angular';
export class GalleryPage {

private images: Array<string>;
private rows: Array<Array<string>>;
private grid: Array<Array<string>>;

constructor(private _navCtrl: NavController, private _navParams: NavParams) {
this.images = this._navParams.get('images');
this.rows = Array(Math.ceil(this.images.length/2));
this.grid = Array(Math.ceil(this.images.length/2));
}

ionViewLoaded() {

var rowNum = 0;
let rowNum = 0;

for (var i = 0; i < this.images.length; i+=2) {
this.rows[rowNum] = Array(2);
for (let i = 0; i < this.images.length; i+=2) {

this.grid[rowNum] = Array(2);

if (this.images[i]) {
this.rows[rowNum][0] = this.images[i]
this.grid[rowNum][0] = this.images[i]
}

if (this.images[i+1]) {
this.rows[rowNum][1] = this.images[i+1]
this.grid[rowNum][1] = this.images[i+1]
}


rowNum++;
}

Expand Down
2 changes: 1 addition & 1 deletion app/pages/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ion-content>
<div class="gallery-button" text-center>
<ion-icon name="images" on-tap="openGallery()"></ion-icon>
<ion-icon name="images"></ion-icon>
<p>Select Photos</p>
</div>
</ion-content>
21 changes: 1 addition & 20 deletions app/pages/home/home.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import { ImagePicker } from 'ionic-native';
import {GalleryPage} from '../gallery/gallery';

@Component({
templateUrl: 'build/pages/home/home.html'
})

export class HomePage {

constructor(private _navCtrl: NavController) {

}

private openGallery (): void {
let options = {
maximumImagesCount: 8,
width: 500,
height: 500,
quality: 75
}

ImagePicker.getPictures(options).then(
file_uris => this._navCtrl.push(GalleryPage, {images: file_uris}),
err => console.log('uh oh')
);
}
constructor(private _navCtrl: NavController) {}

}