title: Download photos from Telegram channel history without file_id
body: <p>I want to download all photo from channel. Try to use <a href="https://github.com/danog/MadelineProto" rel="nofollow noreferrer">https://github.com/danog/MadelineProto</a> to get channel message history:</p>
  
  <pre><code>$MadelineProto-&gt;messages-&gt;getHistory([
      'peer' =&gt; "-100xxxxxx",
      'offset_id' =&gt; 0,
      'offset_date' =&gt; 0,
      'add_offset' =&gt; 0,
      'limit' =&gt; 25,
      'max_id' =&gt; 1000,
      'min_id' =&gt; 0,
      'hash' =&gt; 1,
  ]);
  </code></pre>
  
  <p>As a result I get an array of messages with media:</p>
  
  <pre><code>array(13) {
      ["_"] =&gt; string(7) "message"
      ["out"] =&gt; bool(false)
      ["mentioned"] =&gt; bool(false)
      ["media_unread"] =&gt; bool(false)
      ["silent"] =&gt; bool(false)
      ["post"] =&gt; bool(false)
      ["id"] =&gt; int(38)
      ["from_id"] =&gt; int(500100000)
      ["to_id"] =&gt; array(2) {
          ["_"] =&gt;string(11) "peerChannel"
          ["channel_id"] =&gt;int(1369700000)
      }
      ["date"] =&gt; int(1520150410)
      ["message"] =&gt; string(0) ""
      ["media"] =&gt; array(2) {
          ["_"] =&gt;string(17) "messageMediaPhoto"
          ["photo"] =&gt;array(6) {
              ["_"] =&gt; string(5) "photo"
              ["has_stickers"] =&gt; bool(false)
              ["id"] =&gt; int(5251753100000000000)
              ["access_hash"] =&gt; int(-6118957000000000000)
              ["date"] =&gt; int(1520150405)
              ["sizes"] =&gt; array(4) {
                  [0] =&gt;array(6) {
                      ["_"] =&gt; string(9) "photoSize"
                      ["type"] =&gt; string(1) "s"
                      ["location"] =&gt; array(5) {
                          ["_"] =&gt;string(12) "fileLocation"
                          ["dc_id"] =&gt;int(2)
                          ["volume_id"] =&gt;int(235100000)
                          ["local_id"] =&gt;int(250000)
                          ["secret"] =&gt;int(5193339136300000000)
                      }
                      ["w"] =&gt; int(90)
                      ["h"] =&gt; int(67)
                      ["size"] =&gt; int(1078)
                  }
                  ....
  </code></pre>
  
  <p>Now I want to download this file and didnt known how do it. Method <a href="https://core.telegram.org/bots/api#getfile" rel="nofollow noreferrer">https://core.telegram.org/bots/api#getfile</a> request <strong>file_id</strong> but I havent it.</p>
  
  <p>Message history only give me this photo parameters:</p>
  
  <ul>
  <li>id</li>
  <li>access_hash</li>
  <li>dc_id</li>
  <li>volume_id</li>
  <li>local_id</li>
  <li>secret</li>
  </ul>
  
  <p>How can I get file_id or generate it from available data?</p>
  
  <p>Or how can I download photo from channel history by another way? </p>