close

 

<?php
// 創建新的圖像實例
$im = imagecreatetruecolor(100, 100);

// 設置背景為白色
imagefilledrectangle($im, 0, 0, 99, 99, 0xFFFFFF);

//在圖像上寫字
imagestring($im, 3, 40, 20, 'GD Library', 0xFFBA00);

// 輸出圖像到瀏覽器
header('Content-Type: image/gif');

imagegif($im);
imagedestroy($im);
?>


將一個 PNG 轉換成 GIF

<?php

// 載入 PNG
$png = imagecreatefrompng('./php.png');

// 以 GIF 保存圖像
imagegif($png, './php.gif');

// 釋放內存
imagedestroy($png);

// 完工
echo 'Converted PNG image to GIF with success!';
?>

arrow
arrow
    全站熱搜

    stockwfj3 發表在 痞客邦 留言(0) 人氣()