<?php
//============================
// 文件: filename.php
// 版本: 0.0.1
// 作者: 九月
// 更新: d
// 说明: Editplus集成PHP环境
//============================
$action = $_GET['a'];
$img = new Imagick('test.jpg');
switch($action){
case 'rotate':
$r = $_GET['r']+0;
$img->rotateImage(new ImagickPixel(), $r);
$img->writeImage('test_rotate_'.$r.'.jpg');
$dest = 'test_rotate_'.$r.'.jpg';
break;
case 'flip':
$img->flipImage();
$img->writeImage('test_flip.jpg');
$dest = 'test_flip.jpg';
break;
case 'flop':
$img->flopImage();
$img->writeImage('test_flop.jpg');
$dest = 'test_flop.jpg';
break;
case 'text':
$imgd = new ImagickDraw();
$imgd->setFont("fonts/msyh.ttc");
$imgd->setFontSize(20);
//$imgd->setTextUnderColor(new ImagickPixel ('red'));//设置背景色
$imgd->setFillColor (new ImagickPixel('black'));//设置字体颜色
$imgd->annotation(0, 20, "测试汉字,微软雅黑");//与字体大小有关,20
$img->drawImage($imgd);
$img->writeImage('test_text.jpg');
$dest = 'test_text.jpg';
break;
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<img src="test.jpg" /><br />
<input type="button" value="水平翻转" οnclick="window.location='test.php?a=flop'" />
<input type="button" value="垂直翻转" οnclick="window.location='test.php?a=flip'" />
<input type="button" value="测试汉字" οnclick="window.location='test.php?a=text'" />
<input type="text" id="r" value="<?php echo $_GET['r'] ? $_GET['r'] : '90';?>" size="4" /><input type="button" value="向右旋转度数" οnclick="window.location='test.php?a=rotate&r='+document.getElementById('r').value" /><br />
<img src="<?=$dest?>" />
//============================
// 文件: filename.php
// 版本: 0.0.1
// 作者: 九月
// 更新: d
// 说明: Editplus集成PHP环境
//============================
$action = $_GET['a'];
$img = new Imagick('test.jpg');
switch($action){
case 'rotate':
$r = $_GET['r']+0;
$img->rotateImage(new ImagickPixel(), $r);
$img->writeImage('test_rotate_'.$r.'.jpg');
$dest = 'test_rotate_'.$r.'.jpg';
break;
case 'flip':
$img->flipImage();
$img->writeImage('test_flip.jpg');
$dest = 'test_flip.jpg';
break;
case 'flop':
$img->flopImage();
$img->writeImage('test_flop.jpg');
$dest = 'test_flop.jpg';
break;
case 'text':
$imgd = new ImagickDraw();
$imgd->setFont("fonts/msyh.ttc");
$imgd->setFontSize(20);
//$imgd->setTextUnderColor(new ImagickPixel ('red'));//设置背景色
$imgd->setFillColor (new ImagickPixel('black'));//设置字体颜色
$imgd->annotation(0, 20, "测试汉字,微软雅黑");//与字体大小有关,20
$img->drawImage($imgd);
$img->writeImage('test_text.jpg');
$dest = 'test_text.jpg';
break;
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<img src="test.jpg" /><br />
<input type="button" value="水平翻转" οnclick="window.location='test.php?a=flop'" />
<input type="button" value="垂直翻转" οnclick="window.location='test.php?a=flip'" />
<input type="button" value="测试汉字" οnclick="window.location='test.php?a=text'" />
<input type="text" id="r" value="<?php echo $_GET['r'] ? $_GET['r'] : '90';?>" size="4" /><input type="button" value="向右旋转度数" οnclick="window.location='test.php?a=rotate&r='+document.getElementById('r').value" /><br />
<img src="<?=$dest?>" />