emojipacks icon indicating copy to clipboard operation
emojipacks copied to clipboard

Allow upload of local files.

Open WhileLoop opened this issue 7 years ago • 9 comments

Is this possible? Didn't see anything in the readme about it.

WhileLoop avatar May 19 '17 03:05 WhileLoop

Yeah I think you could make a YAML file that just points to files on your local machine, have you tried that?

zachfeldman avatar May 19 '17 12:05 zachfeldman

Tried it. Maybe I got the syntax wrong?

Uploading aws with ./aws.png (node:23728) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: Invalid URI "./aws.png"

Uploading aws with file://./aws.png (node:23777) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: Invalid protocol: file:

WhileLoop avatar May 19 '17 13:05 WhileLoop

Have you tried an absolute path instead of a relative one?

zachfeldman avatar May 19 '17 14:05 zachfeldman

Absolute path didn't work either.

WhileLoop avatar May 19 '17 20:05 WhileLoop

@WhileLoop Got it. I took a deeper dive into the upload method and realized it loads emojis using the request() lib: https://github.com/lambtron/emojipacks/blob/master/lib/slack.js#L188

In order to load local files, you'd have to integrate a local file reader. Here's a a similar thread: http://stackoverflow.com/questions/30851520/get-local-json-file-using-request-promise

Alternately, you could upload them somewhere temporary and take them down when you're done - you don't need to commit the .yaml file to the repo to use it!

zachfeldman avatar May 19 '17 21:05 zachfeldman

:+1:

kinduff avatar Jun 26 '17 16:06 kinduff

You can also run a local http server (e.g. python3 -m http.server). Then you can use localhost urls.

EaterOA avatar Oct 31 '17 07:10 EaterOA

Nice workaround @EaterOA

kinduff avatar Nov 01 '17 17:11 kinduff

Any recommendations on how to generate a YAML file of a local directory of images?

moustachedelait avatar Jul 31 '18 23:07 moustachedelait