Thursday, 18 May 2017

flickr node.js api upload photo

I build app in Node.js with Flickr API(in npm - flickrapi).

When uploaded photo, in console I get: 'photos uploaded []'.

Why empty array? Any way after my "uploading" no photo in flickr repository.

Photo path - 'D:\test.jpg'. Photo exist - 100%. flickerOption - 100% correct.

var Flickr = require("flickrapi"),
    flickrOptions = {
        api_key: "secret_num",
        secret: "secret_num",
        user_id: "secret_num",
        access_token: "secret_num",
        access_token_secret: "secret_num"
    };


Flickr.authenticate(flickrOptions, function (error, flickr) {

    var uploadOptions = {
        photos: [{
            title: "test",
            tags: [
                "happy fox",
                "test 1"
            ],
            photo: "/test.jpg"
        }, {
            title: "test2",
            tags: "happy fox image \"test 2\" separate tags",
            photo: "/test.jpg"
        }]
    };


    Flickr.upload(uploadOptions, flickrOptions, function (err, result) {
        if (err) {
            return console.error(error);
        }
        console.log("photos uploaded", result);
    });
});



via Roman Melnyk

No comments:

Post a Comment