我想調整IMG通過使用下面的代碼90x90但IMG上傳,但不能調整..調整圖像的大小與ImageMagick的
$image = 'the path to the img';
/*** a new imagick object ***/
$im = new Imagick();
/*** ping the image ***/
$im->pingImage($image);
/*** read the image into the object ***/
$im->readImage($image);
$im->thumbnailImage(90, null);
$im->setImageFormat("png");
/*** write image to disk ***/
$im->writeImage("tmp/spork.png");
$im->destroy();
我的代碼更改爲$im->cropThumbnailImage(90,90);
但它仍然dosent工作。
img被上傳到該文件夾,但沒有調整大小。並且沒有錯誤 – Ben
如果更改$ im-> writeImage(「tmp/spork.png」);到$ im-> writeImage(「spork.png」);該圖像應與代碼 – Bonzo
位於相同的文件夾中您出於興趣而直接使用Imagick而不是Imagemagick。 – Bonzo