image
image copied to clipboard
Orientation Imagick
I am running laravel with s3 storage and trying to orientate() the image. But that fails.
I checked the Intervention\Image\Imagick\Commands\ExifCommand file, which has a function dontPreferExtension(). is there a way i can use that? because when i hardcode it to false, the orientation works
use Intervention\Image\Imagick\Commands\ExifCommand;
use Intervention\Image\Imagick\Driver;
class MyImagickDriver extends Driver
{
/**
* Executes named command on given image
*
* @param Image $image
* @param string $name
* @param array $arguments
* @return \Intervention\Image\Commands\AbstractCommand
*/
public function executeCommand($image, $name, $arguments)
{
if ($name === 'exif') {
$command = new ExifCommand($arguments);
$command->dontPreferExtension();
$command->execute($image);
return $command;
}
return parent::executeCommand($image, $name, $arguments);
}
public function getDriverName()
{
return 'Imagick';
}
}
use Intervention\Image\Imagick\Commands\ExifCommand; use Intervention\Image\Imagick\Driver; class MyImagickDriver extends Driver { /** * Executes named command on given image * * @param Image $image * @param string $name * @param array $arguments * @return \Intervention\Image\Commands\AbstractCommand */ public function executeCommand($image, $name, $arguments) { if ($name === 'exif') { $command = new ExifCommand($arguments); $command->dontPreferExtension(); $command->execute($image); return $command; } return parent::executeCommand($image, $name, $arguments); } public function getDriverName() { return 'Imagick'; } }
@frederikbosch Hi, Could you please give more detail for the use of this code?
If you want to use the dontPreferExtension
method in the ExifCommand
class, you have to create your own driver and overload the executeCommand
method . However, you are also required to overload the getDriverName
method and return Imagick
as the driver name to make sure all other command keep working.
Then create the ImageManager
as is explained in the usage overview.
new ImageManager(['driver' => new MyImagickDriver()]);