@@ -309,6 +309,44 @@ public function resize_nonBoolUpsize()
309309 Image::resize (new \Imagick (), 10 , 10 , ['upsize ' => 'not bool ' ]);
310310 }
311311
312+ /**
313+ * Verify images are rotated according to EXIF header
314+ * @test
315+ * @covers ::resize
316+ * @covers ::resizeMulti
317+ */
318+ public function resize_orientation ()
319+ {
320+ $ files = [
321+ "{$ this ->_sourceFilesDir }/bottom-right.jpg " ,
322+ "{$ this ->_sourceFilesDir }/left-bottom.jpg " ,
323+ "{$ this ->_sourceFilesDir }/right-top.jpg " ,
324+ "{$ this ->_sourceFilesDir }/top-left.jpg " ,
325+ ];
326+
327+ $ imageResults = [];
328+
329+ foreach ($ files as $ file ) {
330+ $ source = new \Imagick ($ file );
331+ $ imageWidth = $ source ->getimagewidth ();
332+ $ imageHeight = $ source ->getimageheight ();
333+ $ imageResults [] = Image::resize ($ source , $ imageWidth , $ imageHeight , []);
334+ }
335+
336+ $ this ->assertSame (
337+ ['r ' => 254 , 'g ' => 0 , 'b ' => 0 , 'a ' => 1 ], $ imageResults [0 ]->getImagePixelColor (0 , 0 )->getColor ()
338+ );
339+ $ this ->assertSame (
340+ ['r ' => 0 , 'g ' => 0 , 'b ' => 0 , 'a ' => 1 ], $ imageResults [1 ]->getImagePixelColor (0 , 0 )->getColor ()
341+ );
342+ $ this ->assertSame (
343+ ['r ' => 0 , 'g ' => 255 , 'b ' => 1 , 'a ' => 1 ], $ imageResults [2 ]->getImagePixelColor (0 , 0 )->getColor ()
344+ );
345+ $ this ->assertSame (
346+ ['r ' => 0 , 'g ' => 0 , 'b ' => 254 , 'a ' => 1 ], $ imageResults [3 ]->getImagePixelColor (0 , 0 )->getColor ()
347+ );
348+ }
349+
312350 /**
313351 * Downsize ratio 2.0 to 0.25 and 2.0 to 4.0
314352 *
0 commit comments