Happy
Happy

Reputation: 802

How to tweet picture with text

I want to share my app images in Twitter. I want to tweet picture with text using Javascript and php and Twitter Api's with callback functions. How can i do this?

I have tried

<script type="text/javascript" src="jquery.twitterbutton.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#twitterbutton-example').twitterbutton({
            user: 'POSimplicity',
            title: ' powered by POSimplicity',
            count_url: false,
            user_description: 'user description',
            url: 'http://www.abc.in/index.php',
            ontweet: function (response) {
                var id = $("p").html();

                $.ajax({
                    url: 'add_customer.php',
                    data: 'twitpoints=' + '<?php echo $res['
                    0 ']['
                    regpoints ']; ?>' + '&total_points=' + '30' + '&customer_id=' + id,
                    dataType: 'html',
                    success: function (res) {
                        alert(res);
                    }
                });
            },
            lang: 'en'
        });
    });
</script>

In this i am able to tweet URL but not images.

Upvotes: 11

Views: 7776

Answers (1)

Prateek
Prateek

Reputation: 342

You should try this twitter API to upload images with tweet : https://dev.twitter.com/docs/api/1/post/statuses/update_with_media

updated link: https://dev.twitter.com/rest/reference/post/statuses/update

Upvotes: 2

Related Questions