fromjpeg')) { copy($sourcefile, $destfile); $return = array('filesize' => filesize($destfile), 'width' => $src_width, 'height' => $src_height); return $return; } $src_scale = $src_width / $src_height; $des_scale = $forcedwidth / $forcedheight; if ($src_width <= $forcedwidth && $src_height <= $forcedheight) { $des_width = $src_width; $des_height = $src_height; } elseif ($src_scale >= $des_scale) { $des_width = ($src_width >= $forcedwidth) ? $forcedwidth : $src_width; $des_height = $des_width / $src_scale; $des_height = ($des_height >= $forcedheight) ? $forcedheight : $des_height; } else { $des_height = ($src_height >= $forcedheight) ? $forcedheight : $src_height; $des_width = $des_height * $src_scale; $des_width = ($des_width >= $forcedwidth) ? $forcedwidth : $des_width; } $des_width = ceil($des_width); $des_height = ceil($des_height); switch ($getimgsize['mime']) { case 'image/jpeg': $img_src = imagecreatefromjpeg($sourcefile); !$img_src && $img_src = imagecreatefromgif($sourcefile); break; case 'image/gif': $img_src = imagecreatefromgif($sourcefile); !$img_src && $img_src = imagecreatefromjpeg($sourcefile); break; case 'image/png': $img_src = imagecreatefrompng($sourcefile); break; case 'image/wbmp': $img_src = imagecreatefromwbmp($sourcefile); break; default : return $return; } if (!$img_src) return $return; $img_dst = imagecreatetruecolor($des_width, $des_height); imagefill($img_dst, 0, 0, 0xFFFFFF); imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $des_width, $des_height, $src_width, $src_height); $tmppath = isset($conf['tmp_path']) ? $conf['tmp_path'] : ini_get('upload_tmp_dir') . '/'; '/' == $tmppath AND $tmppath = './tmp/'; $tmpfile = $tmppath . md5($destfile) . '.tmp'; switch ($destext) { case 'jpg': imagejpeg($img_dst, $tmpfile, 75); break; case 'jpeg': imagejpeg($img_dst, $tmpfile, 75); break; case 'gif': imagegif($img_dst, $tmpfile); break; case 'png': imagepng($img_dst, $tmpfile); break; } $r = array('filesize' => filesize($tmpfile), 'width' => $des_width, 'height' => $des_height);; copy($tmpfile, $destfile); is_file($tmpfile) && unlink($tmpfile); imagedestroy($img_dst); return $r; } function well_image_clip($sourcefile, $destfile, $clipx, $clipy, $clipwidth, $clipheight, $getimgsize = '') { global $conf; empty($getimgsize) AND $getimgsize = getimagesize($sourcefile); if (empty($getimgsize)) { return 0; } else { $imgwidth = $getimgsize[0]; $imgheight = $getimgsize[1]; if (0 == $imgwidth || 0 == $imgheight) { return 0; } } if (!function_exists('imagecreatefromjpeg')) { copy($sourcefile, $destfile); return filesize($destfile); } switch ($getimgsize[2]) { case 1 : $imgcolor = imagecreatefromgif($sourcefile); break; case 2 : $imgcolor = imagecreatefromjpeg($sourcefile); break; case 3 : $imgcolor = imagecreatefrompng($sourcefile); break; case 15: $imgcolor = imagecreatefromwbmp($sourcefile); break; case 18: $imgcolor = imagecreatefromwebp($sourcefile); break; } if (!$imgcolor) return 0; $img_dst = imagecreatetruecolor($clipwidth, $clipheight); imagefill($img_dst, 0, 0, 0xFFFFFF); imagecopyresampled($img_dst, $imgcolor, 0, 0, $clipx, $clipy, $imgwidth, $imgheight, $imgwidth, $imgheight); $tmppath = isset($conf['tmp_path']) ? $conf['tmp_path'] : ini_get('upload_tmp_dir') . '/'; '/' == $tmppath AND $tmppath = './tmp/'; $tmpfile = $tmppath . md5($destfile) . '.tmp'; imagejpeg($img_dst, $tmpfile, 75); $n = filesize($tmpfile); copy($tmpfile, $destfile); is_file($tmpfile) && unlink($tmpfile); return $n; } function well_image_ext($filename) { return strtolower(substr(strrchr($filename, '.'), 1)); } ?>ubuntu系统安装时在分区时的操作
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ubuntu系统安装时在分区时的操作

运维笔记admin3浏览0评论

文章目录

  • 前言
  • 一、问题描述
  • 二、解决方案
    • 方式一、与`windows`系统共存
      • 具体步骤
      • 优点
      • 注意事项:
    • 方式二、自主分区
      • 第一步、划分`EFI`分区
      • 第二步、划分`交换空间`分区
      • 第三步、划分根(`/`)分区
      • 优点
      • 注意事项
  • 三、总结

前言

在安装 ubuntu 时,分区是一个绕不开的重要步骤。正确的分区方式不仅能保证系统正常运行,还能满足用户的个性化需求。ubuntu 提供了多种分区选项,其中最常见的是“与 windows 系统共存”和“自主分区”。本文将详细介绍这两种方式的操作流程和适用场景,帮助你在安装 ubuntu 时做出明智选择。


一、问题描述

ubuntu 安装过程中,分区选项通常出现在“安装类型”界面。用户可以选择:

  • Windows 系统共存:适合希望保留 Windows 并实现双系统的用户。
  • 自主分区:适合需要自定义分区布局的高级用户。

二、解决方案

方式一、与windows系统共存

这种方式简单易用,适合新手或需要双系统的用户。安装程序会自动调整磁盘空间,在保留 windows 的同时为 ubuntu 创建分区。

具体步骤

  1. 事先在window系统,利用磁盘管理对一个大的分区进行压缩卷。例如,300GB压缩100GB,然后将这个100GB的卷进行删除卷操作;
  2. ubuntu安装界面选择与 windows 并存选项即可。

优点

  • 操作简单,自动化程度高
  • 保留 windows 系统及其数据

注意事项:

  • 建议备份数据以防万一
  • 确保磁盘空间足够支持双系统

方式二、自主分区

自主分区允许用户完全控制分区布局。

第一步、划分EFI分区

一般设置为512MB即可

第二步、划分交换空间分区

交换空间(swap)用于内存不足时的虚拟内存,一般设置为内存大小的2倍,即电脑内存为8GB,设置为16GB(16000)

第三步、划分根(/)分区

根分区(/)是 ubuntu 的核心分区,包含系统文件和程序,剩下来的所有空间分配给/即可。

优点

  • 灵活性高,可根据需求调整分区
  • 适合单系统或复杂磁盘布局

注意事项

  • 操作前备份数据,分区错误可能导致数据丢失

三、总结

  • windows 共存适合希望快速安装双系统的新手用户,操作简单但灵活性较低。
  • 自主分区适合有经验的用户,可以精确控制分区布局,例如单独划分 EFIswap 和根分区,满足多样化需求。

无论选择哪种方式,建议根据实际需求和硬件条件规划磁盘空间,并在操作前做好数据备份。希望这篇博客能为你安装 ubuntu 提供清晰的指引!如果有其他问题,欢迎留言讨论。

发布评论

评论列表(0)

  1. 暂无评论