2012-09-20 62 views
0

這裏被存儲在服務器映像imagick工程..但我不知道如何,如果我在$路徑陣列的遠程URL替換工作imagick與遠程URL

$background = new Imagick('back.jpg'); 
    $paths = array(
     "img/1.jpg", 
     "img/2.jpg", 
     "img/3.jpg", 
     "img/4.jpg", 
    ); 

    $images = new Imagick($paths); 
    foreach($images as $image){ 
     $image->thumbnailImage($width, NULL); 
     $background->compositeImage($image, Imagick::COMPOSITE_OVER, $x ,$y); 
    } 
+0

使用file_get_contents或其他類似方法獲取圖像,從您獲得的內容創建圖像資源並開始工作。或者,您可以將圖像下載到臨時目錄,從那裏打開並使用該圖像資源。 – clentfort

回答

1

嘗試使用file_get_contentsfile_put_contents暫時將圖像存儲在本地服務器上:

<?php 
$remote_image = file_get_contents("http://foo.com/remote_image.jpg"); 
file_put_contents("/tmp/remote_image.jpg", $remote_image); 
$image = new Imagick("/tmp/remote_image.jpg"); 
?>