Posting images with ofxOAuth on tumblr

hello of community…

i’m trying to use ofxOAuth to post images on tumblr… i got the provided example running and authentication just works fine… i’m also able to create text posts with…"/v2/blog/" + oauth.getConsumerKey() + “&type=text&state=draft&tags=sinsynplus,digital%20art,generative%20design,realtime,artists%20on%20tumblr&tweet=off&format=html&source_url=”);

posting an image also works when using the source parameter…"/v2/blog/" + oauth.getConsumerKey() + “&type=photo&state=draft&tags=sinsynplus,digital%20art,generative%20design,realtime,artists%20on%20tumblr&format=html&source_url=”);

but i can’t upload images using the data parameter… gives me always an error 401…

in ofxOAuth.h these functions are provided…

std::string get(const std::string& uri,
const std::string& queryParams = “”);

std::string post(const std::string& uri,
const std::string& queryParams = “”);

std::string postfile_multipartdata(const std::string& uri,
const std::string& queryParams = “”,
const std::string& filefieldname = “”,
const std::string& filepath = “”);

i’m not sure if uploading images should work with post or if postfile_multipartdata has to be used…

maybe somebody ran into the same problem and can provide a solution…

and greetz


This is directly related to Posting images on twitter with openframeworks … maybe there are some clues over there?

thanks for the quick reply…

i read the post you recommend yesterday… actually i did search all posts related to ofxOAuth… and it seems there are no posts related to using ofxOAuth in combination with tumblr…

now i can confirm ofxJSON is working fine… at least ny times example… twitter example says something about new api…
ofxTwitter search example works… post example does not…

also exchanged ofxOAuth with the pelayomendez version…

so it seems to be a problem with posting in general… maybe not even related to tumblr…

i’m on osx 10.7 using xcode 4.6.3



Hi there!

I had a project in which I would take some photos and manipulate them in OF, save them on the computer and then post them on Tumblr. But instead of using ofxOAuth, or other add-ons, I used a system() call inside my OF application to a python script. pyTumblr is very simple and does everything I need.

I know I’m not answering your exact question, but maybe this can also solve your problem. Good work!

thanks… very interesting workaround…
i will definitively try your approach…



Another approach is to go into your tumblr settings and look for your ‘secret email’ address. Anything you send to this will post on your tumblr- images, text, hashtags, etc. Of course you will need a way to send an email from OF to do this- usually a script and system call like @hubris mentioned is easiest. Good luck!

It’s also super easy to send emails with attachments using ofxSMTP

1 Like

Hi @bakercp, just to leave a note… I’ve tried using ofxSMTP, but it didn’t work.

I could send the e-mails to Tumblr, and it would post the subject and text body. But not the image-attachment. Probably related to the way the image is encoded.

Odd. Did you get any errors or investigate further? People have been using it successfully in other circumstances for quite some time, so if there’s a bug, I’d love to get it fixed.

No errors at all. Just no image on the post. I also tested the following…

I sent an e-mail to my personal address, just to check if attachments were working on ofxSMTP. It did.

Next, I tested if Tumblr was working correctly. So I sent an e-mail via Gmail. And it also worked.

At this point I thought that maybe ofxSMTP sends attachments as inline. So I tested an inline image with Gmail. It worked, but you get the body text you wrote, plus something like [image: inline image 1].

I didn’t have much time, and it was getting over my current knowledge, so I decided to go with the python script.

( I had a post-it to remind me to reference this on the forum, but I forgot to. : / )

seems like i had the wrong fork of pelayomendez:feature-postmultipart/formdata…

strange thing is that github tells me here…

There isn’t anything to compare.
bakercp:master is up to date with all commits from pelayomendez:feature-postmultipart/formdata.

now i got ofxTwitter example for posting working (needs to create a new project using the project generator…) as well as the twitter example that comes with ofxOAuth…

unfortunately the ofxOAuth tumblr example still doesn’t post images… instead giving 401 errors…

still trying to get the syntax right…

std::string fullPath = ofToDataPath(“render.gif”, true);

oauth.postfile_multipartdata("/v2/blog/" + oauth.getConsumerKey(), “&type=photo&state=draft&tags=sinsynplus,digital%20art,generative%20design,gif,artists%20on%20tumblr&format=html&source_url=”, “data[]”, fullPath);



@bakercp Trying to use ofxTwitter with the latest version of ofxOauth curl reports an SSL Certficate problem. There has been some Linux tweaking since my branch was merged so maybe thats related?

  • About to connect() to port 443 (#0)
  • Trying…
  • connected
  • Connected to ( port 443 (#0)
  • SSL certificate problem: unable to get local issuer certificate
  • Closing connection #0
  • Peer certificate cannot be authenticated with given CA certificates
    [verbose] ofxOAuth::post: HTTP post request failed.