title: Imagick PHP - Getting DPI for AI file
body: <p>I want to get the resolution of an AI file but it only returns 72. However, the resolution is supposed to be 300. If I were to change the resolution of the image using imagick, it would come out to be something far less [the dimensions]. How can I get the actual resolution of a file?</p>
  <p>In case I can't use imagick for that, is there a library or framework that can give me the precised resolution of a file (regardless what type)?</p>
  <p>I have my code as:</p>
  <pre><code>try {
          $imagick = new Imagick($imagePath);
          $data = $imagick-&gt;identifyimage();
      }
      catch(Exception $e) {
          echo json_encode('ERROR: ' . $e-&gt;getMessage()); 
      }
      
      if($data['units'] == 'PixelsPerCentimeter') {
          $imageResolution = $imagick-&gt;getImageResolution(); // Temp Image Resolution
          //echo 'pixels per cent lol';
          if (!empty($imageResolution['y'])) {
              $dpi = intval( round($imageResolution['y'] * 2.54, 2) );
          }
        }
      else $dpi = $data['resolution']['x'];
    
      $width = round($data['geometry']['width'] / $dpi, 3);
      $height = round($data['geometry']['height'] / $dpi, 3);
  </code></pre>