如果您使用 Windows ImageMagick,至少在我的情況下,您必須包含檔案的完整路徑,包括開頭的 'c:'。如果您不確定檔案名稱的來源方式,可以使用 realpath() 函式將其正規化。
<?php
$incoming_file = '/Users/John/Desktop/file_loco.jpg';
$img = new Imagick(realpath($incoming_file));
// realpath() 會將 '/Users/John/Desktop/file_loco.jpg' 轉換為 'C:\Users\John\Desktop\file_loco.jpg'
// 並且 ImageMagick 在載入時不會有問題
?>