0

I want to increase image resolution and size (upscale). Please suggest being a useful method. And guide me on how to configure it with Laravel. I have used this piece of code, but here I found an Error: Class "Imagick" not found.

~

$imagePath = "photo-compare-before.jpg";
function improve_qaulity_image($imagePath) {
    $imagick = new Imagick(realpath($imagePath));
    $imagick->enhanceImage();
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}
improve_qaulity_image($imagePath);

~

Fahad
  • 17
  • 3
  • 3
    Installation instructions for Imagick can be found [here](https://www.php.net/manual/en/imagick.installation.php) – apokryfos Jun 26 '22 at 17:23
  • Thank you for your answer. Sir can you please guide me, how to install and configure it with Laravel. – Fahad Jun 26 '22 at 18:26
  • 1
    On windows, you can download the DLL [here](https://pecl.php.net/package/imagick) and then put it in your PHP extensions directory and add `extension=imagick` for Ubuntu or debian you can probably do `apt-get install php-imagick`. There's probably a homebrew recipe in MacOS as well. Not sure what OS you have so your instructions may vary – apokryfos Jun 26 '22 at 18:35
  • I using windows OS and PHP Version 8.0.13, Compiler Visual C++ 2019, and Architecture x64. So which pecl(zip) file I need to download form here [link](https://windows.php.net/downloads/pecl/deps/) – Fahad Jun 26 '22 at 19:07
  • 1
    [here](https://pecl.php.net/package/imagick/3.7.0/windows) you would download the 8.0 x64 and for the thread safety you need to check with what PHP installation you are using (e.g. by using command `phpinfo()`) – apokryfos Jun 26 '22 at 19:19

0 Answers0