php合并图片

$pic_path ) {  
        $pathInfo    = pathinfo($pic_path);  
		//var_dump(pathinfo($pic_path));die;
        switch( strtolower($pathInfo['extension']) ) {  
            case 'jpg':  
            case 'jpeg':  
                $imagecreatefromjpeg    = 'imagecreatefromjpeg';  
            break;  
            case 'png':  
                $imagecreatefromjpeg    = 'imagecreatefrompng';  
            break;  
            case 'gif':  
            default:  
                $imagecreatefromjpeg    = 'imagecreatefromstring';  
                $pic_path    = file_get_contents($pic_path);  
            break;  
        }
		$resource   = $imagecreatefromjpeg($pic_path); 
		if($k == 0){
			imagecopyresized($background,$resource,500,310,0,0,120,120,imagesx($resource),imagesy($resource));
		}else if($k == 1){
			imagecopyresized($background,$resource,250,710,0,0,120,120,imagesx($resource),imagesy($resource));
		} 
    }  
	//echo $background;die;
    header("Content-type: image/jpg");  
    imagejpeg($background);  
      
?>  

你可能感兴趣的:(小玩意)