當前位置:首頁 » 編程語言 » imagemagickphp

imagemagickphp

發布時間: 2023-09-26 23:21:57

php imagick 是什麼,是怎麼安裝的,centos系統

imagick是一個PHP的擴展,是用ImageMagick提供的API來進行圖片的操作,不過這些操作已經包裝到擴展imagick中去了,最終調用的是ImageMagick提供的API,所以使用imagick首先要安裝ImageMagick。
ImageMagick圖片處理是一套功能強大、穩定而且免費的工具集和開發包,可以用來讀、寫和處理圖片文件,詳細的解釋見ImageMagick的官方網站,ImageMagick比GD的性能要高很多,如果是在處理大量的圖片時更加能體現ImageMagick的性能

㈡ PHP擴展之ImageMagick函數執行問題。

試一下這個類吧 phpthumb
配置phpthumb讓他使用ImageMagick來生成縮略圖
phpthumb是一個功能非常強大的縮略圖生成類,支持jpg,bmp,gif,png等格式圖片生成。無論您是PHP項目還是其它項目只要你能有一台PHP的主機就可以使用phpthumb帶給您編程上的方便。因為他還支持遠程圖片生成。
phpthumb可以配合ImageMagick來使用,這樣就不會再受到PHP內存大小的限制了,還可以生成gif動畫。下面就講如何讓phpthumb用ImageMagick來生成生成圖片。

無論win平台還是linux平台phpthumb默認是開啟ImageMagick的,只不過配置錯誤和程序有一點小問題。首先就是安裝ImageMagick這個程序。不用安裝php_imagick這個PHP擴展。phpthumb使用的是命令行操作的,所以php應該可以運行一個進程才可以,不然請選擇另外的主機。安裝好後請按下面的步驟進行phpthumb的修改。
1.打開phpThumb.config.php查找
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
// Windows: set absolute pathname
$PHPTHUMB_CONFIG['imagemagick_path'] = 'C:/Program Files/ImageMagick-6.6.0-Q16/convert.exe';
} else {
// *nix: set absolute pathname to "convert", or leave as null if "convert" is in the path (location detected with `which`)
//$PHPTHUMB_CONFIG['imagemagick_path'] = '/usr/local/bin/convert';
$PHPTHUMB_CONFIG['imagemagick_path'] = null;
}
將上面的$PHPTHUMB_CONFIG['imagemagick_path'] 設成你安裝的正確路徑。上面共計有兩個地方,第一個是window平台。第二個是LINUX,UNIX平台的。請根據您的系統選擇設定。上面紅色部分為ImageMagick路徑,替換時注意目錄分隔符是/不是\。
2.打開phpThumb.class.php
查找 function ImageMagickVersion($returnRAW=false) {在這附近
有if (eregi('^Version: [^0-9]*([ 0-9\\.\\:Q/]+) (http|file)\:', $versionstring[1], $matches)) {
替換成if (eregi('^Version: (.+) (http|file)\:', $versionstring[1], $matches)) {

OK全部設定已經完成您的phpthumb已經自動使用ImageMagick生成圖片了。

㈢ 請問群暉NAS的PHP中如何安裝imagick擴展

群暉NAS 不知道是什麼套件。

imagemagick 是php的pecl擴展,可以在pecl資源網站上找到並下載對應版本的

PECL::imagick

linux系統選擇tgz下載,windows系統點擊對應版本的dll鏈接,會進入到windows版本的下載頁,根據你的php版本下載,如果沒有對應你的php的版本,說明你選擇的版本不支持,換一個版本去下載( imagick3.4對應php7.1-7.3, imagick3.3對應php 5.3-5.6 )

下載完成後將擴展文件放到php的擴展目錄,並在php.ini中加上擴展引入

extension = php_imagick

㈣ phpstudy安裝imagick擴展庫怎麼裝

phpstudy安裝imagick擴展庫的過程:

1、到imagemagick官網下載imagemagickwindows安裝包:

10、出現224就證明安裝成功。

㈤ php怎麼輸出背景透明的圖片

php可以使用GD庫或者ImageMagick工具生成png或者gif的背景透明圖片.推薦使用ImageMagick.
這里有範例 http://php.net/manual/en/imagick.examples-1.php
准備一張png圖片,放到php文件的目錄,運行看看效果.
<?php
/* Read the image */
$im = new Imagick("test.png");
/* Thumbnail the image */
$im->thumbnailImage(200, null);

/* Create a border for the image */
$im->borderImage(new ImagickPixel("white"), 5, 5);

/* Clone the image and flip it */
$reflection = $im->clone();
$reflection->flipImage();

/* Create gradient. It will be overlayed on the reflection */
$gradient = new Imagick();

/* Gradient needs to be large enough for the image and the borders */
$gradient->newPseudoImage($reflection->getImageWidth() + 10, $reflection->getImageHeight() + 10, "gradient:transparent-black");

/* Composite the gradient on the reflection */
$reflection->compositeImage($gradient, imagick::COMPOSITE_OVER, 0, 0);

/* Add some opacity. Requires ImageMagick 6.2.9 or later */
$reflection->setImageOpacity( 0.3 );

/* Create an empty canvas */
$canvas = new Imagick();

/* Canvas needs to be large enough to hold the both images */
$width = $im->getImageWidth() + 40;
$height = ($im->getImageHeight() * 2) + 30;
$canvas->newImage($width, $height, new ImagickPixel("black"));
$canvas->setImageFormat("png");

/* Composite the original image and the reflection on the canvas */
$canvas->compositeImage($im, imagick::COMPOSITE_OVER, 20, 10);
$canvas->compositeImage($reflection, imagick::COMPOSITE_OVER, 20, $im->getImageHeight() + 10);

/* Output the image*/
header("Content-Type: image/png");
echo $canvas;
?>

熱點內容
家用電腦安裝伺服器內存 發布:2025-02-01 14:38:50 瀏覽:256
增量調制編解碼實驗報告 發布:2025-02-01 14:30:30 瀏覽:787
不良人2無敵傷害腳本 發布:2025-02-01 14:23:04 瀏覽:398
地圖flash源碼 發布:2025-02-01 14:13:33 瀏覽:957
家庭影院配置什麼樣的音響 發布:2025-02-01 14:04:33 瀏覽:545
蘋果手機存儲空間不能用怎麼回事 發布:2025-02-01 14:03:04 瀏覽:259
qq易語言盜號源碼 發布:2025-02-01 14:01:25 瀏覽:812
源神比較好的雲伺服器 發布:2025-02-01 13:55:27 瀏覽:208
黑蘋果idea編譯慢 發布:2025-02-01 13:45:30 瀏覽:552
c和linux 發布:2025-02-01 13:39:38 瀏覽:177