Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 865
Happy Avatar asked Feb 26 '14 04:02

Happy


People also ask

How do I embed a photo in a Tweet?

Tap the camera icon to add a new photo or video to your Tweet. Tap the photo icon to attach an existing photo, video, or GIF. Once you have 2 or more photos selected, you can tap and hold a photo to drag and reorder before Tweeting.

How do I Tweet a picture from my phone?

In the Twitter app, tap the compose tweet button to create a new tweet. Under the box where you can compose your message, you will see quick selection options for adding a photo or video. Recently-taken photos in your camera's gallery appears as thumbnails, which you can tap to quickly add that photo to your tweet.


1 Answers

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

like image 158
Prateek Avatar answered Oct 04 '22 16:10

Prateek