sahusoftcom / plupload-angular-directive

An angular directive wrapper for the cross browser upload script plupload.
Apache License 2.0
61 stars 32 forks source link

Is this a way to make uploaded images preview? #24

Open se-panfilov opened 9 years ago

se-panfilov commented 9 years ago

Hi, thanks for work. I'm using the directive to upload only images and i wish to find a way to make thumbnails preview.

Is there is a way to do this? First I'm trying to do smt like

on-file-added="previewImage()"
$scope.previewImage = function(img){
    console.log(img);
}

But this didn't work for me. What i do wrong? Is this possible?

epicleptico commented 9 years ago

You cannot show an image using the console.

You must access to the file Input what is on plupload and retrieve image info, later transform it to Base64 and put it in <img src=""> attribute.

I did this in a fork from the plupload directive, but i have no time atm to update base repo.

I can paste you a gist with the upgraded FilesAdded event and you can try to upgrade this repo with it.

https://gist.github.com/epicleptico/c96d1b79e653b9cb5bba

Note: In the gist i use a service that help to assign a default image given a mime type. This service is called mimeservice. If want to use you must comment lines where this service is used. Also max width and max height are constants defined in file

se-panfilov commented 9 years ago

So, I'm make a fork: avl-inforus/plupload-angular-directive. Thumbnails are available now.

bower install plupload-angular-2

I'm make a fork from codeconsole/plupload-angular-directive repo (see this PR which upgrades directive to plupload2).

And, of course, I'm included your fork's code for thumbnails.

Also I'm replaced grunt with gulp and added sourcemaps.

After all I think there is no reason to make pull-request anymore.

epicleptico commented 9 years ago

@Light241 great work