最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to tweet picture with text - Stack Overflow

programmeradmin1浏览0评论

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: '.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.

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.

Share Improve this question edited Aug 30, 2016 at 3:37 Brian Webster 30.9k51 gold badges157 silver badges227 bronze badges asked Feb 26, 2014 at 4:37 HappyHappy 8022 gold badges11 silver badges33 bronze badges 4
  • 3 @ShankarDamodaran Even Google doesn't answer that, so I don't think that ment is appropriate here.. – Mr. Alien Commented Feb 26, 2014 at 4:43
  • @ShankarDamodaran I agree with mr alien skimming the twitter api there is no mention of embeding images with the tweet – brendosthoughts Commented Feb 26, 2014 at 4:44
  • blog.twitter./2011/photo-upload-api – Derek 朕會功夫 Commented Feb 26, 2014 at 4:47
  • real work goes to @Derek朕會功夫 dev.twitter./docs/api/1/post/statuses/update_with_media using a media[] array you can apparently upload a media asset image only using the post method – brendosthoughts Commented Feb 26, 2014 at 4:51
Add a ment  | 

1 Answer 1

Reset to default 2

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

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

发布评论

评论列表(0)

  1. 暂无评论