diff --git a/DependencyInjection/LiipImagineExtension.php b/DependencyInjection/LiipImagineExtension.php
index 4e7450355..13bfc6966 100644
--- a/DependencyInjection/LiipImagineExtension.php
+++ b/DependencyInjection/LiipImagineExtension.php
@@ -8,6 +8,7 @@
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
+use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
class LiipImagineExtension extends Extension
@@ -62,13 +63,14 @@ public function load(array $configs, ContainerBuilder $container)
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('imagine.xml');
- $container->setAlias('liip_imagine', new Alias('liip_imagine.'.$config['driver']));
-
- if (!class_exists('Imagine\Image\Metadata\MetadataReaderInterface')) {
- $container->getDefinition('liip_imagine.'.$config['driver'])->removeMethodCall('setMetadataReader');
+ if (interface_exists('Imagine\Image\Metadata\MetadataReaderInterface')) {
+ $container->getDefinition('liip_imagine.'.$config['driver'])->addMethodCall('setMetadataReader', array(new Reference('liip_imagine.meta_data.reader')));
+ } else {
$container->removeDefinition('liip_imagine.meta_data.reader');
}
+ $container->setAlias('liip_imagine', new Alias('liip_imagine.'.$config['driver']));
+
$container->setParameter('liip_imagine.cache.resolver.default', $config['cache']);
$container->setParameter('liip_imagine.filter_sets', $config['filter_sets']);
diff --git a/Imagine/Filter/Loader/AutoRotateFilterLoader.php b/Imagine/Filter/Loader/AutoRotateFilterLoader.php
index 5d9096f09..23b880adb 100644
--- a/Imagine/Filter/Loader/AutoRotateFilterLoader.php
+++ b/Imagine/Filter/Loader/AutoRotateFilterLoader.php
@@ -11,6 +11,12 @@
*/
class AutoRotateFilterLoader implements LoaderInterface
{
+
+ protected $orientationKeys = array(
+ 'exif.Orientation',
+ 'ifd0.Orientation'
+ );
+
/**
* {@inheritDoc}
*/
@@ -61,7 +67,15 @@ private function getOrientation(ImageInterface $image)
{
//>0.6 imagine meta data interface
if (method_exists($image, 'metadata')) {
- return $image->metadata()->offsetGet('exif.Orientation');
+ foreach ($this->orientationKeys as $orientationKey) {
+ $orientation = $image->metadata()->offsetGet($orientationKey);
+
+ if ($orientation) {
+ return $orientation;
+ }
+ }
+
+ return null;
} else {
$data = exif_read_data("data://image/jpeg;base64," . base64_encode($image->get('jpg')));
return isset($data['Orientation']) ? $data['Orientation'] : null;
diff --git a/Resources/config/imagine.xml b/Resources/config/imagine.xml
index 333ca1314..dc95c6643 100644
--- a/Resources/config/imagine.xml
+++ b/Resources/config/imagine.xml
@@ -103,9 +103,7 @@
-
-
-
+