Giter VIP home page Giter VIP logo

angularjs-imageupload-directive's People

Contributors

cellofellow avatar mischi avatar passy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angularjs-imageupload-directive's Issues

dataURL type

This is an awesome plugin, but I found that the 'type' variable maybe is wrong, in the line 26 is this code:
var type = options.resizeType || 'image/jpg';
and I think it should be:
var type = options.resizeType || 'image/jpeg';
The image/jpg type returns a png data type, and with the image/jpeg string, it returns a jpeg data type and is faster than the other way.

BTW thanks a lot.

Base64 Encoding

I've noticed that canvas-to-blob converts the Canvas into a blob through a data URL. As it happens my needs are for the base64 encoded image, so the use of Blob is an extra layer I don't need, and I have extra complexity to XHR the blob and convert it to a base64 string.

Could you add an option to have the uploaded image available as a base64 data URL, and skip the Blob step?

Unsafe prefix for blob links

Came upon an "unsafe" blob prefix that resulted in a broken image for {{image.url}}.
However, {{image.dataURL}} worked nicely in it's place.

The cause and work-around is documented in angular/angular.js#3889.

My environment:

  • Angular version 1.2.0-rc.2
  • Chrome Version 29.0.1547.76 m

The following was the recommended fix in this case and it works for me:

myModule.config(['$compileProvider', function($compileProvider) {
    var oldWhiteList = $compileProvider.imgSrcSanitizationWhitelist();
    $compileProvider.imgSrcSanitizationWhitelist(/^\s (https|ftp|file|blob):|data:image\//);
});

No file when posting to .Net Web API?

Hi,

I'm having some trouble posting files to a .Net Web API site. It appears the file is being added to the form and posted, but when it arrives at the server the code can't find any files attached to the form (there's a property on the http request called "files" that I'm checking).

Is there any additional configuration I might need on the Angular side so my server picks up the files within the form?

I tried out another Angular JS file upload solution and it appears to work fine - but I like the additional features this project has (resizing etc).

Thanks,

Paul

A Serious ISSUE

hi, Mischi, It's an usefult directive, and please change the follow

angular.module('imageupload', [])
    .directive('image',  function($q) {...}

to

angular.module('imageupload', [])
    .directive('image', ['$q', function($q) {...}]

otherwise, it is not work after uglify. for the param $q may be converted to another name such as a,b,c,f, etc by uglify compiler.

Uncaught TypeError: Type error

I have made "How to run the Demo?", and cant do anything with it, after starting server i see the demo page, when i try to upload somth i have a error in chrome console:
Uncaught TypeError: Type error imageupload.js:51
resizeImage imageupload.js:51
(anonymous function) imageupload.js:89
image.onload

in imageupload.js:
ctx.drawImage(origImage, 0, 0, width, height);
Uncaught TypeError: Type error

Add Button / Clear Button Not Working

For me, the add button does nothing. In fact, it is disabled and never becomes enabled. Also, the clear button clears the fields but not the previews. I didn't know if that was by design.

Upload progress?

Is there a progress value attached to image when you submit the image of the request submitting the base64 image?

EXIF Orientation not being considered

This directive needs to be able to recognise EXIF orientation data and rotate accordingly, otherwise it's pretty useless unless the photos are taken with an older device or made in photoshop etc.

Auto upload feature

Having the image uploaded automatically on selecting a file would be nice.
That would eliminate the need to have 'add' and 'clear' buttons on the page.
Could be controlled with a flag.

Modified to use template within directive

Hi Mischi,

I've modified your JS to use a template within the directive:

template:
'' +
'Select upload photo: ' +
''
,

for my specific needs within current project, so I can have a one-liner in my view (I've also cut out multiple images support), effectively making this widget "plug-and-play".

Do you feel it's something worth sharing with the community?

(btw thanks for publishing this - saved me a lot of time!)

Multifile upload async scope issue

Essentially what is happening is that if you select a number of files at the same time with the system file picker, the async call:

fileToDataURL(files[i]).then(function (dataURL) {
  imageResult.dataURL = dataURL;
});

results in dataURL being set only on the final image.

Cut and paste the example in the readme isnt working

I set up all as required with the script calls etc. Cut and paste the simple two line example in the Readme, and nothing at all happens when I select an image, the image tag doesn't show, so Im assuming the image attribute was never assigned a value. I think you may have a bug, its the same in the latest Chrome, FF, and Safari

<input type="file" accept="image/*" image="image"/> <img ng-show="image" ng-src="{{image.url}}" type="{{image.file.type}}" />

Just to be sure I provided an extra call to the image {{image}} outside of the call to see if the scope was actually getting the value of the image, but it is never does. $cope doesn't have any image property after uploading.

Angular NaNmageDirective error

Error: [$injector:unpr] http://errors.angularjs.org/1.2.27/$injector/unpr?p0=aProvider%20%3C-%20a%20%3C-NaNmageDirective at Error (native) at http://www.example.com/min/admin-production.min.js:19:10395 at http://www.example.com/min/admin-production.min.js:19:25331 at Object.c [as get] (http://www.example.com/min/admin-production.min.js:19:24402) at http://www.example.com/min/admin-production.min.js:19:25405 at c (http://www.example.com/min/admin-production.min.js:19:24402) at Object.d [as invoke] (http://www.example.com/min/admin-production.min.js:19:24617) at http://www.example.com/min/admin-production.min.js:19:29463 at f (http://www.example.com/min/admin-production.min.js:19:10732) at Object.<anonymous> (http://www.example.com/min/admin-production.min.js:19:29430)

HI i am getting this error while directive call

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.