public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing1.vsd");
     # get master
     $master = $diagram->getMasters()->getMasterByName("Circle");
     # get byte array
     $bytes = $master->getIcon();
     # create an image file
     $fos = new FileOutputStream($dataDir . "star.png");
     # write byte array of the image
     $fos->write($bytes);
     # close array
     $fos->close();
     print "Get shape icon, please check the output file." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "drawing.vsd");
     $shapes = $diagram->getPages()->getPage("Flow 1")->getShapes();
     $i = 0;
     $typeValue = new TypeValue();
     while ($i < (int) (string) $shapes->getCount()) {
         $shape = $shapes->get($i);
         # Filter shapes by type Foreign
         if ($shape->getType() == $typeValue->FOREIGN) {
             # create an image file
             $fos = new FileOutputStream($dataDir . "Image#{i}.bmp");
             $fos->write($shape->getForeignData()->getValue());
             $fos->close();
         }
         $i += 1;
     }
     print "Extracted images successfully!" . PHP_EOL;
 }