Skip to content

Utilities

Kwasi Yonkopa edited this page Aug 17, 2019 · 5 revisions

Displaying photos from file system

Sometimes you want users to preview a photo before setting as profile picture or as display picture for an item. You can display photos from the the users file system using Utilities.showPhoto(). You may only want to do this within an event (.onchange) handler.

Utilities.showPhoto(input, preview)

// Example
Utility.showPhoto(e.target, document.getElementById('cover-img'));

Parameters
input = An preview = An

Ocassionally, you may want to do something like initializing a cropper after the image has been loaded.

Utility.showPhoto.ready = function() {
    //Initialize cropper here
}

Don't forget to include a file input in your form.

Search

This utility makes it easy to implement a real time search, it searches by a 'column' through a list of nodes.

Clone this wiki locally