tumblr / jumblr

Tumblr API v2 Java Client
Apache License 2.0
278 stars 105 forks source link

PhotoPost should support byte[] or InputStream types #19

Open msgilligan opened 11 years ago

msgilligan commented 11 years ago

The API is currently limited to only reading the Photo image from a file. It would be nice to have other options available.

seejohnrun commented 11 years ago

Cool - will do this week - in the meantime something like a tempFile should get you where you want to go

msgilligan commented 11 years ago

I've been using a tempFile, but that is problematic for several reasons. When do you think you'll have something ready to test?

seejohnrun commented 11 years ago

Hey @msgilligan - I'm taking a look at this today It's a bit tricky due to how the data is passed around but I should have something for you by EOD

seejohnrun commented 11 years ago

Where I'm headed with this: https://github.com/tumblr/jumblr/tree/byte_data

msgilligan commented 11 years ago

Thanks! That looks like it will work for me. I'd like to see a stream-based solution, too -- but I'm not yet in a position to try that out. I'm using Jumblr on the server and proxying file uploads, so I think it might be cool to be able to wire InputStream to OutputStream, but I also realize that approach is somewhere between tricky and impossible.

Also, are you sure you want to eliminate the File-based solution (which might be good for Android apps )

When will you be ready for me to try this out?

seejohnrun commented 11 years ago

Heya - the File based solution is still there - it overloads setData and reads the file on set. Should be ready soon - just need to clean up some tests

msgilligan commented 11 years ago

That makes sense. I don't know if or how much you care about not loading the whole file into memory...

seejohnrun commented 11 years ago

I can make the base of FileData take an input stream and mime type instead. Will get that together

On Tuesday, July 16, 2013, Sean Gilligan wrote:

That makes sense. I don't know if or how much you care about not loading the whole file into memory...

— Reply to this email directly or view it on GitHubhttps://github.com/tumblr/jumblr/issues/19#issuecomment-21063967 .

msgilligan commented 11 years ago

Yeah, that sounds like the most flexible approach...

AbrahamAriel commented 8 years ago

This was long time ago but how I go with the tempFile method since there are still no other way to do this?

File works fine inside IDE but when I'm trying it outside with a .JAR that I built I get 401 error.

seejohnrun commented 8 years ago

This branch was close: https://github.com/tumblr/jumblr/blob/byte_data/src/main/java/com/tumblr/jumblr/types/PhotoPost.java

Otherwise tempFile as long as you're able to write to a tmp directory from your JAR. What is the path of the tempFile you're constructing?