本文整理汇总了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();
}