angular-base64-upload | Converts files from file input into base64 encoded models
kandi X-RAY | angular-base64-upload Summary
kandi X-RAY | angular-base64-upload Summary
![Alt text] "Travis-CI build status"). Converts files from file input into base64 encoded models. This directive is based from one of the answers in this [SO question] Requires angular version greater than or equal to 1.2.0. Tested on angular versions 1.2.0 through 1.3.15.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of angular-base64-upload
angular-base64-upload Key Features
angular-base64-upload Examples and Code Snippets
Community Discussions
Trending Discussions on angular-base64-upload
QUESTION
Converting an image to base64 in angular 2, image is uploaded from local . Current am using fileLoadedEvent.target.result. The problem is, when I send this base64 string through REST services to java, it is not able to decode it. When i try this base64 string with free online encoder-decoder, there also I cannot see decoded image. I tried using canvas also. Am not getting proper result. One thing is sure the base64 string what am getting is not proper one, do I need to add any package for this ? Or in angular 2 is there any perticular way to encode the image to base64 as it was there in angular 1 - angular-base64-upload package.
Pls find below my sample code
...ANSWER
Answered 2017-Feb-27 at 10:29Working plunkr for base64 String
QUESTION
I am having an issue converting the input file object into Base64 in my ionic v2 app. The issue occurs specifically when using the onload/onloadend reader as it gets called only occasionally (rarest of rarest to be very specific).
I am able to get the file name, size and object when the user clicks on a image file which triggers the attachFile function, but after that when i convert the file object to Base64 using FileReader - onload or onloadend the callback function rarely gets called and the file object is not getting converted to Base64 as a result of this.
File input:
Attach File:
...ANSWER
Answered 2017-May-02 at 10:28Check this . https://plnkr.co/edit/PFfebmnqH0eQR9I92v0G?p=preview
Template
QUESTION
I need to prevent a image uploading if over a set size, my error works and shows if image is over set size but the image still uploads. I am using angular-base64-upload.
I do not know why image still displays when its over the limet, any idea why ?
thanks
HTML
...ANSWER
Answered 2017-Sep-21 at 18:12your input
is listening for an onchange
event to do the uploading—nothing prevents this change event from proceeding.
form.files.$error.maxsize
will return true
or false
, so use that boolean to drive whether or not the change event proceeds with the upload attempt.
I suggest moving your upload logic into your controller.
Also, if you use ng-change
, you could shorten your reference to your controller method:
ng-change="imageUpload(this, form.files.$error.maxsize)"
If you expand your imageUpload
method to take a second argument, you can check if the image is too big to proceed:
QUESTION
I have a simple angular controller to post a new name and display the name on the page.
The problem is I cant see the name and the rest of the details to show in the scope ....
Any idea how to fix this and why its not working ?
HTML
...ANSWER
Answered 2017-Sep-21 at 12:42Are you sure property c_name exists on the data returned by the $http.post ? . Add a console log to print what you really get. You also have to ensure there is no error by setting an error callback. I also suggest to give a name other than data for the result (res instead of data for example):
QUESTION
I'm new to developing with AngularJs and I have a function where converting images to base 64 using the Angular-Base64-Upload, I'd like to know how to resize images to a standard size of about 500px.
...ANSWER
Answered 2017-Sep-04 at 11:32app.controller('ctrl', function ($scope, $q) {
$scope.resizeImage = function ( file, base64_object ) {
// file is an instance of File constructor.
// base64_object is an object that contains compiled base64 image data from file.
var deferred = $q.defer();
var url = URL.createObjectURL(file);// creates url for file object.
Jimp.read(url)
.then(function (item) {
item
.resize(1280, Jimp.AUTO)// width of 1280px, auto-adjusted height
.quality(50)//drops the image quality to 50%
.getBase64(file.type, function (err, newBase64) {
if (err) {throw err;}
var bytes = Math.round((3/4)*newBase64.length);
base64Object.filetype = file.type;
base64Object.filesize = bytes;
base64Object.base64 = newBase64;
// Note that base64 in this package doesn't contain "data:image/jpeg;base64," part,
// while base64 string from Jimp does. It should be taken care of in back-end side.
deferred.resolve(base64Object);
});
})
.catch(function (err) {
return console.log(err);// error handling
});
return deferred.promise;
};
});
QUESTION
Regardless of the version specified in the "bower.json" file, bower (v1.8.0) ignores it and downloads the latest version of the library available.It is not asking to specify the version. Downgrading to the earlier version (v1.3.8) of bower didn't help :(. For example i have specified anuglarjs as 1.5.8 but it downloads 1.6.4.
My bower.json
...ANSWER
Answered 2017-Apr-09 at 23:18Remove the ^
symbol in front of the version number. This means "at least this version". In other words: It won't update your library if the version is equal or higher to the specified version, but if you are installing a new workspace, it will take the newest one.
Here are some more information: What is the bower (and npm) version syntax?
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install angular-base64-upload
Bower - bower install angular-base64-upload
NPM - npm install angular-base64-upload
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page