Example #1
0
 /**
  * Process an Image
  *
  * @param Image $image
  *
  * @return ImagineInterface
  */
 public function process(Image $image)
 {
     $processors = $image->getProcessedSalts();
     $image = $this->imagine->open($image->getOriginalImagePath());
     // Apply each method one after the other
     foreach ($processors as $method => $arguments) {
         if (empty($arguments) or isset($arguments[0])) {
             $image = $this->executeMethod($image, $method, $arguments);
         } else {
             foreach ($arguments as $submethod => $arguments) {
                 $this->executeSubmethod($image, $method, $submethod, $arguments);
             }
         }
     }
     return $image;
 }