Skip to content

Commit

Permalink
Step 22.16: Create DisplayImageFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kisiela authored and Dotan Simha committed Nov 22, 2016
1 parent 2c20971 commit 4fcd2d2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions imports/ui/filters/displayImageFilter.js
@@ -0,0 +1,26 @@
import angular from 'angular';

import { Meteor } from 'meteor/meteor';

const name = 'displayImageFilter';

function DisplayImageFilter(image) {
if (!image) {
return image;
}

// leave it as it is for the web view
if (!Meteor.isCordova) {
return image.url;
}

// create new path of an image
const path = `ufs/${image.store}/${image._id}/${image.name}`;
return Meteor.absoluteUrl(path);
}

// create a module
export default angular.module(name, [])
.filter(name, () => {
return DisplayImageFilter;
});

0 comments on commit 4fcd2d2

Please sign in to comment.