Example #1
0
 public function testAddsFilterMethodToFiltersList()
 {
     $extension = new ImagineExtension($this->createCacheManagerMock());
     $filters = $extension->getFilters();
     $this->assertInternalType('array', $filters);
     $this->assertCount(1, $filters);
 }
Example #2
0
 private function normalizeImages()
 {
     if (empty($this->images)) {
         return;
     }
     foreach ($this->images as $imageKey => $image) {
         if (!array_key_exists($imageKey, $this->normalizedEntity)) {
             throw new Exception('This image field not exists!');
         }
         if (!empty($this->normalizedEntity[$imageKey])) {
             $filteredImage = $this->imagine->filter($this->normalizedEntity[$imageKey], $image['filter']);
             $this->normalizedEntity[$imageKey] = '<a href="' . $filteredImage . '" target="_blank"><img src="' . $filteredImage . '"/></a>';
         } else {
             $this->normalizedEntity[$imageKey] = '-';
         }
     }
 }