本文整理匯總了PHP中image::getobj方法的典型用法代碼示例。如果您正苦於以下問題:PHP image::getobj方法的具體用法?PHP image::getobj怎麽用?PHP image::getobj使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類image
的用法示例。
在下文中一共展示了image::getobj方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _cachePhoto
protected static function _cachePhoto($cache_dir, $file_name, $file_type)
{
if (!$file_name || !$file_type) {
return false;
}
//生產緩存文件(縮放後的圖)
$cache_path_name = ROOT_PATH . $cache_dir;
$cache_file_path = $cache_path_name . md5($file_name) . '.' . $file_type;
//目錄不存在,創建目錄
if (!is_dir($cache_path_name)) {
@mkdir($cache_path_name, 0755, true);
}
if (!is_file($cache_file_path)) {
// if( strstr( $file_name, PhotoM::uploadPath ) ){//舊的存儲方式
// image::getobj()->imageinit( ROOT_PATH . $file_name, 1, 800, 800, 0, 0, $cache_file_path )->outimage();
// }else{//新的存儲方式
// image::getobj()->imageinit( ROOT_PATH . PhotoM::uploadPath . $file_name, 1, 800, 800, 0, 0, $cache_file_path )->outimage();
// }
image::getobj()->imageinit(ROOT_PATH . PhotoM::uploadPath . $file_name, 1, 800, 800, 0, 0, $cache_file_path)->outimage();
}
}
示例2: image
public function image()
{
$tu = '{"std_ratio":0.36618333333333,"real_ratio":1,"x":10,"y":10,"width":173,"height":270,"tu_x":80,"tu_y":60}';
// $tu = isset( $_REQUEST['tu'] ) ? $_REQUEST['tu'] : '';
$tu = json_decode($tu, true);
$img_path = HOME_PATH . "images/208.png";
$file_path = HOME_PATH . "images/6.png";
$is_tshirt = 0;
$endaddress = HOME_PATH . "images/209.png";
// $img=imagecreatefrompng($endaddress);
// $bg = imagecolorallocate($img,255,255,255);
// imagecolortransparent($img,$bg);
// header("Content-type: image/png");
// imagepng($img,HOME_PATH . "images/300.png");
// throw new Exception( 'exit' );
//使用圖片裁剪功能
// image::getobj()->imageinit(HOME_PATH . "images/1.jpg", 2, "50,50", "50,50", HOME_PATH . "images/5.jpg");
//縮放圖
// image::getobj()->imageinit( HOME_PATH . "images/3.png", 1, "260", "260" )
// ->outimage();
// throw new Exception( 'exit' );
//使用加圖片水印功能
image::getobj()->imageinit($img_path, 3, $file_path, "5", $is_tshirt)->imagescaling2($tu['real_ratio'])->positionim($tu['x'], $tu['y'], $tu['width'], $tu['height'], $tu['tu_x'], $tu['tu_y'])->setbackground(255, 255, 255)->outimage();
}