title: How to download photos from telegram channel using Madeline?
body: <p>I use MadelineProto
  I need to get a photo from the last post in telegram
  The code I use:</p>
  <pre><code>&lt;?php
  if (!file_exists('madeline.php')) {
      copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
  }
  include 'madeline.php';
  
  $MadelineProto = new \danog\MadelineProto\API('session.madeline');
  $MadelineProto-&gt;start();
  
  $channel = '@example';
  $offset_id = 0;
  $limit = 1;
  
  $messages_Messages = $MadelineProto-&gt;messages-&gt;getHistory(['peer' =&gt; $channel, 'offset_id' =&gt; $offset_id, 'offset_date' =&gt; 0, 'add_offset' =&gt; 0, 'limit' =&gt; $limit, 'max_id' =&gt; 0, 'min_id' =&gt; 0, 'hash' =&gt; 0 ]);
  
  $message = $messages_Messages['messages'][0];
  echo json_encode($message);
  
  $MadelineProto-&gt;downloadToFile($message, &quot;/tmp.png&quot;);
  </code></pre>
  <p>$message :</p>
  <pre><code>{&quot;_&quot;:&quot;messageMediaPhoto&quot;,&quot;photo&quot;:{&quot;_&quot;:&quot;photo&quot;,&quot;has_stickers&quot;:false,&quot;id&quot;:5**54901******2695,&quot;access_hash&quot;:-82*****8334,&quot;file_reference&quot;:{&quot;_&quot;:&quot;bytes&quot;,&quot;bytes&quot;:&quot;AkV4QiEAABFvYFze*****QoZFrTBH7fvQ=&quot;},&quot;date&quot;:1616692497,&quot;sizes&quot;:[{&quot;_&quot;:&quot;photoStrippedSize&quot;,&quot;type&quot;:&quot;i&quot;,&quot;bytes&quot;:{&quot;_&quot;:&quot;bytes&quot;,&quot;bytes&quot;:&quot;ASgdpA8dV\/EU0n*****FFJjTA==&quot;}},{&quot;_&quot;:&quot;photoSize&quot;,&quot;type&quot;:&quot;m&quot;,&quot;location&quot;:{&quot;_&quot;:&quot;fileLocationToBeDeprecated&quot;,&quot;volume_id&quot;:4****0743,&quot;local_id&quot;:44***85},&quot;w&quot;:231,&quot;h&quot;:320,&quot;size&quot;:12760},{&quot;_&quot;:&quot;photoSize&quot;,&quot;type&quot;:&quot;x&quot;,&quot;location&quot;:{&quot;_&quot;:&quot;fileLocationToBeDeprecated&quot;,&quot;volume_id&quot;:4000****43,&quot;local_id&quot;:44***6},&quot;w&quot;:502,&quot;h&quot;:696,&quot;size&quot;:36269}],&quot;dc_id&quot;:4}}
  </code></pre>
  <p>The data on the photo comes in, but the file is not created, what is the problem?</p>