Esempio n. 1
0
 /**
  * Get a instance of Karla.
  *
  * @param string $binPath
  *            Path to imagemagic binaries (optional)
  * @param Cache|null $cache
  *            Cache controller (optional)
  *
  * @return Karla
  * @throws \InvalidArgumentException
  */
 public static function perform($binPath = '/opt/local/bin/', Cache $cache = null)
 {
     if (!Karla::$instance instanceof Karla) {
         try {
             Karla::$instance = new Karla($binPath, $cache);
         } catch (\InvalidArgumentException $e) {
             throw new \RuntimeException($e->getMessage() . '(' . $binPath . ')');
         }
     }
     return Karla::$instance;
 }
Esempio n. 2
0
 /**
  * Example 11
  *
  * @return array
  */
 private function _example11()
 {
     $basepath = dirname(__FILE__) . DIRECTORY_SEPARATOR;
     Karla::perform()->convert()->raw('-vignette 5x65000 -gaussian-blur 20')->in($basepath . 'demo.jpg')->out($basepath . 'demo-magic.png')->execute();
     $cleanCommand = $this->_cleanPath(Karla::perform()->convert()->raw('-vignette 5x65000 -gaussian-blur 20')->in($basepath . 'demo.jpg')->out($basepath . 'demo-magic.png')->getCommand());
     return array('name' => 'Do \'magic\' stuff', 'original' => 'demo.jpg', 'result' => 'demo-magic.png', 'imagick' => '//Not possible', 'code' => 'Karla::perform()->convert()->raw(\'-vignette 5x65000 -gaussian-blur 20\')->in(\'demo.jpg\')->out(\'demo-magic.png\')->execute();', 'console' => $cleanCommand);
 }