/**
  * Get actual image data for this image. This can be saved to a file or sent to the browser to
  * produce the converted image.
  *
  * Call getExtension() or getMimeType() with the same $format argument to learn what file type the
  * returned data uses.
  *
  * @param ResourceLoaderContext $context Image context, or any context if $variant and $format
  *     given.
  * @param string|null $variant Variant to get the data for. Optional; if given, overrides the data
  *     from $context.
  * @param string $format Format to get the data for, 'original' or 'rasterized'. Optional; if
  *     given, overrides the data from $context.
  * @return string|false Possibly binary image data, or false on failure
  * @throws MWException If the image file doesn't exist
  */
 public function getImageData(ResourceLoaderContext $context, $variant = false, $format = false)
 {
     if ($variant === false) {
         $variant = $context->getVariant();
     }
     if ($format === false) {
         $format = $context->getFormat();
     }
     $path = $this->getPath($context);
     if (!file_exists($path)) {
         throw new MWException("File '{$path}' does not exist");
     }
     if ($this->getExtension() !== 'svg') {
         return file_get_contents($path);
     }
     if ($variant && isset($this->variants[$variant])) {
         $data = $this->variantize($this->variants[$variant], $context);
     } else {
         $data = file_get_contents($path);
     }
     if ($format === 'rasterized') {
         $data = $this->rasterize($data);
         if (!$data) {
             wfDebugLog('ResourceLoaderImage', __METHOD__ . " failed to rasterize for {$path}");
         }
     }
     return $data;
 }