Exemple #1
0
 function testSetThumbBox()
 {
     $magicHand = new MagicHand('src', 'dst');
     $magicHand->setThumbBox([300, 200]);
     $this->assertEquals(300, $magicHand->getThumbBox()->getWidth());
     $this->assertEquals(200, $magicHand->getThumbBox()->getHeight());
 }
 /**
  * 运行命令
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return true
  */
 function execute(InputInterface $input, OutputInterface $output)
 {
     $src = $input->getOption('src');
     $dst = $input->getOption('dst');
     $mode = $input->getOption('mode');
     //初始化
     $magicHand = new MagicHand($src, $dst);
     if (!empty($mode)) {
         $magicHand->setThumbMode($this->transformMode($mode));
     }
     //设置缩略size
     $questionHelper = new QuestionHelper();
     $size = $this->getSizeFromQuestion($questionHelper, $input, $output);
     $magicHand->setThumbBox($size);
     //绑定ui事件
     $this->bindEventsForUi($magicHand, $output);
     //运行
     $magicHand->run();
     return true;
 }