How to use imagick's writeImage() function?
10,441
Might be some file system problem. Try and get a file pointer in php first and check for any problems
$fileHandle = fopen("path/to/image.jpg", "w");
You can then use Imagick function (version 6.3.6 or newer);
$im->writeImageFile($filehandle);
Author by
Admin
Updated on July 12, 2022Comments
-
Admin almost 2 years
This works if I keep the script in the same directory as the image being manipulated. And the resultant image "foo.jpg" is also generated in the same location.
<?php $im = new imagick('image.jpg'); $im->thumbnailImage( 200, 0); $im->writeImage("foo.jpg"); ?>
But what if the script is in one location and the image I wish to work with is in another and the location I wish to save the thumbnail to is somewhere else, how to specify these paths?
Doing something like this doesn't work:
$im = new imagick('path/to/image.jpg');
-
Felix Aballi almost 7 yearsPerhaps you should declare: $imagick= new Imagick('path/to/image'); $imagick->writeImage('path/to/image'); $imagick->close(); $imagick->destroy(); to release all resources.