title: How to tweet multiple images using twitter API?
body: <p>Why bellow code tweet only one image not all three?</p>
  
  <p>I want single tweet with multiple images using twitter API. At twitter API there is mention that you may attach up to 4 photos, 1 animated GIF or 1 video in a Tweet. </p>
  
  <pre><code>$this-&gt;load-&gt;library('twitterext/tmhoauth');
  $this-&gt;config-&gt;load('hybridauthlib', TRUE);
  $cunsumer = $this-&gt;config-&gt;item('hybridauthlib');
  $tmhoauth = new tmhoauth(array(
     'consumer_key' =&gt; $cunsumer['providers']['Twitter']['keys']['key'],
     'consumer_secret' =&gt; $cunsumer['providers']['Twitter']['keys']['secret'],
     'user_token' =&gt; $np["networktoken"],
     'user_secret' =&gt; $np["networksecret"],
  ));
  
  $media1='C:\wamp\www\vx\assets\uploads\post\post_10326.png';
  $params1=array('media' =&gt; base64_encode(file_get_contents($media1));
  $media2='C:\wamp\www\vx\assets\uploads\post\post_10327.png';
  $params2=array('media' =&gt; base64_encode(file_get_contents($media2));
  $media3='C:\wamp\www\vx\assets\uploads\post\post_10328.png';
  $params3=array('media' =&gt;base64_encode(file_get_contents($media3));
  
  //after request 
  $media_id=array();
  for ($i=1; $i &lt;4 ; $i++) { //suppose
  
    $url = 'https://upload.twitter.com/1.1/media/upload.json';
    $code = $tmhoauth-&gt;request('POST', $url, $params.$i, true);
       if ($code == 200) {
           $response = json_decode($tmhoauth-&gt;response['response']);
           $media_id[] = $response-&gt;media_id_string;
  
       } else {
           $response-&gt;error = $tmhoauth-&gt;response['response'];
       }
  
  
  }
  
  $messageparams['media_ids']=$media_id;
  $messageparams['status']='my message';
  $response = $adapter-&gt;api()-&gt;post('statuses/update.json', $messageparams);
  </code></pre>