title: Spatie/pdf-to-image get number of images always returns 0
body: <p>I'm using the <a href="https://github.com/spatie/pdf-to-image" rel="nofollow noreferrer">spatie/pdf-to-image</a> with laravel to create thumbnails of uploaded pdf files. What is weird is that the code was working at one point now it isn't. <code>$pdf-&gt;getNumberOfPages();</code> always returns <code>0</code> no matter how many pages the pdf contains. </p>
  
  <p>This is the constructor in the Spatie Pdf class. As you can see it is just using imagick's <code>getNumberImages();</code> </p>
  
  <pre><code>public function __construct($pdfFile)
  {
      if (! filter_var($pdfFile, FILTER_VALIDATE_URL) &amp;&amp; ! file_exists($pdfFile)) {
          throw new PdfDoesNotExist();
      }
      $this-&gt;imagick = new Imagick($pdfFile);
      $this-&gt;numberOfPages = $this-&gt;imagick-&gt;getNumberImages();
      $this-&gt;pdfFile = $pdfFile;
  }
  </code></pre>
  
  <p>This is a simplified version of my controller:</p>
  
  <pre><code>   public function uploadDocument(Request $request) {
  
         $doc = $request-&gt;file('document');
  
         $pdf = new \Spatie\PdfToImage\Pdf($doc);
  
         $pages = $pdf-&gt;getNumberOfPages();
         dd($pdf);
  </code></pre>
  
  <p>The output of the dump is:</p>
  
  <pre><code>    Pdf {#315 ▼
        #pdfFile: UploadedFile {#236 ▶}
        #resolution: 144
        #outputFormat: "jpg"
        #page: 1
        +imagick: Imagick {#407}
        #numberOfPages: 0
        #validOutputFormats: array:3 [▼
            0 =&gt; "jpg"
            1 =&gt; "jpeg"
            2 =&gt; "png"
        ]
        #layerMethod: 14
        #colorspace: null
        #compressionQuality: null
     }
  </code></pre>
  
  <p>I know for a fact this was working at one point and I'm leaning towards imagick as the culprit. No errors and no exceptions. Is there a simple way to test this theory?</p>