$image=new Imagick();
$image->readImage("image.jpg");
$image->setImageFileName("imagecopy.jpg");
$image->writeImage();
i am getting this error
Fatal error: Uncaught exception 'ImagickException' with message 'unable to open image `image.jpg': No such file or directory @ error/blob.c/OpenBlob/2514' in C:\\xampp\\htdocs\\imagick\\1.php:41
Stack trace: #0 C:\\xampp\\htdocs\\imagick\\1.php(41): Imagick->readimage('image.jpg') #1 {main} thrown in
any one know how can i correct it.
This appears to be a bug with ImageMagick. It uses the Apache core dir as reference. You can work around this by using __DIR__
or __FILE__
to construct an absolute path.
For example, to use the script's directory, do the following:
$im = new imagick (__DIR__ . DIRECTORY_SEPARATOR . 'a.jpg');
Hopefully that helps!
Try This one :
$image=new Imagick($_SERVER['DOCUMENT_ROOT'] . "your image folder path"."image.jpg");
$image->readImage($_SERVER['DOCUMENT_ROOT'] . "your image folder path"."image.jpg");
$image->setImageFileName("imagecopy.jpg");
$image->writeImage();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.