$s=new\SaeStorage();
$f=new\SaeFetchurl();
$img=new\SaeImage();
SAE圖像處理服務(wù)
1:獲取圖像屬性
$img1=file_get_contents(url);
$img=new\SaeImage($img1);
$size=$img->getImageAttr();
2:個(gè)遠(yuǎn)程圖片添加文字水印,并且把新圖片保存到sae上
$img_data= $f->fetch( $first_img_pic);
$img->setData($img_data );
$img->annotate("xxxzz", 1, $gravity=SAE_Static,
? ? $font = array("name"=>SAE_SimSun, "size"=>30, "weight"=>300, "color"=>"yellow"));//等比縮放
$Smallimg= $img->exec(); //執(zhí)行處理并返回處理后的二進(jìn)制數(shù)據(jù)
$s->write('uploads',"bookfile/examples11.jpg",$Smallimg, -1);
3:縮放圖片
function resize($width=0, $height=0){}//只指定width或者h(yuǎn)eight時(shí),將進(jìn)行等比縮放
4:按比例縮放.1為原大小
function resizeRatio($ratio=0.5){}
5:對(duì)圖片進(jìn)行裁剪
function crop($lx=0.25, $rx=0.75, $by=0.25, $ty=0.75){
*@param float $lx x起點(diǎn)(百分比模式,1為原圖大小,如0.25)
* @param float $rx x終點(diǎn)(百分比模式,1為原圖大小,如0.75)
* @param float $by y起點(diǎn)(百分比模式,1為原圖大小,如0.25)
* @param float $ty y終點(diǎn)(百分比模式,1為原圖大小,如0.75)
}