Can a file object be converted to an image object?
I am in need of the width and height from the file (which is an image). Here is my code:
view:
<button id="image_file" class="md-button md-raised md-primary"
type="file" ngf-select="uploadFile($file)">
SELECT FILE
</button>
<md-input-container>
<div class="raised">
<input id="image_file_name" type="text" ng-model="vm.file.name"></input>
</div>
</md-input-container>
controller:
app.controller('imageController', function($scope, fileService) {
$scope.vm = {};
$('.intro').show(1000);
$scope.uploadFile = function(file) {
$scope.vm.file = "";
$scope.vm.file = file; //<---- for instance here, how should it be done?
fileService.uploadFile($scope);
}
service:
angular.module('app')
.service('fileService', function ($http, validationService) {
this.uploadFile = function ($scope){
if (validationService.isFileValidate($scope)) {
$scope.vm.acceptableFormat = true;
} else {
$scope.vm.acceptableFormat = false;
}
};
});