表示時間
繰り返し回数 (0は無限)
フレーム1
フレーム2
フレーム3
フレーム4
フレーム5
フレーム6
#!/usr/local/bin/php
<?php
include_once './rkt_imagemagick.php';

_main();    // 実行関数

// ------------------------------------------------
// 実行関数
// 引数         なし
// 戻り値       なし
// ------------------------------------------------
function _main()
{
    if (empty(
$_POST['manip'])){
        return ;
    }

    
$objimg = new RKT_imagemagick();

    
$frame = array();
    for (
$row=0$row<6$row++){
        if (isSet(
$_FILES['frame'.$row])) {
            if (!empty(
$_FILES['frame'.$row]['tmp_name'])) {
                if (
preg_match("/image/i"$_FILES['frame'.$row]['type'])){
                    if (
file_exists ($_FILES['frame'.$row]['tmp_name'])){
                        
$frame[] = $_FILES['frame'.$row]['tmp_name'];
                    }
                } 
// if (preg_match("/image/i", $_FILES['frame'.$row]['type']))
            
// if (!empty($_FILES['frame'.$row]['tmp_name']))
        
// if (isSet($_FILES['frame'.$row]))
    
// for ($row=0; $row<6; $row++)

    
$delay = empty($_POST['delay'])?100:$_POST['delay'];
    
$loop = empty($_POST['loop'])?0:$_POST['loop'];

    
$objimg->animated($frame$delay$loop);
    
$objimg->save('animated.gif');
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Pragma" content="no-cache">
        <meta http-equiv="Cache-Control" content="no-cache">
        <meta http-equiv="Expires" content="Thu, 01 Dec 1994 16:00:00 GMT">
        <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
        <meta http-equiv="Content-Style-Type" content="text/css">
        <title>rktImageMagickでGIFアニメ</title>
    </head>
    <body>
<?php   if (empty($_POST['manip'])){ ?>
        <form name="imagick" method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>">
            <table cellpadding="4" cellspacing="1">
                <tr>
                    <td>表示時間</td>
                    <td><input type="text" name="delay" value="100" style="width:60px;" /></td>
                </tr>
                <tr>
                    <td>繰り返し回数</td>
                    <td><input type="text" name="loop" value="0" style="width:40px;" />(0は無限)</td>
                </tr>
                <tr>
                    <td>フレーム1</td>
                    <td><input type="file" name="frame0" style="width:190px;" /></td>
                </tr>
                <tr>
                    <td>フレーム2</td>
                    <td><input type="file" name="frame1" style="width:190px;" /></td>
                </tr>
                <tr>
                    <td>フレーム3</td>
                    <td><input type="file" name="frame2" style="width:190px;" /></td>
                </tr>
                <tr>
                    <td>フレーム4</td>
                    <td><input type="file" name="frame3" style="width:190px;" /></td>
                </tr>
                <tr>
                    <td>フレーム5</td>
                    <td><input type="file" name="frame4" style="width:190px;" /></td>
                </tr>
                <tr>
                    <td>フレーム6</td>
                    <td><input type="file" name="frame5" style="width:190px;" /></td>
                </tr>
                <tr>
                    <td colspan="2"><input type="submit" name="manip" value="送信" style="width:190px;" /></td>
                </tr>
            </table>
        </form>
<?php   ?>
        <img src="./animated.gif" />

<?php   
if (empty($_POST['manip'])){
    
highlight_file('index.php');
}
?>
    </body>
</html>