首页
关于
Search
1
PHP图片判断大小压缩代码
8 阅读
2
Linux系统压缩目录下的图片
7 阅读
3
CSS:backdrop-filter实现磨砂玻璃(毛玻璃glassmorphism)特效
1 阅读
PHP
LINUX
登录
Search
标签搜索
压缩
Behram
累计撰写
3
篇文章
累计收到
0
条评论
首页
栏目
PHP
LINUX
页面
关于
搜索到
3
篇与
的结果
2025-02-03
CSS:backdrop-filter实现磨砂玻璃(毛玻璃glassmorphism)特效
一、什么是backdrop-filterbackdrop-filter 属性可以让你为一个元素后面区域添加图形效果(如模糊或颜色偏移)。 因为它适用于元素背后的所有元素,为了看到效果,必须使元素的背景至少部分透明。backdrop-filter和background两个属性就可以把后边的背景图片设置成毛玻璃特效 Glassmorphismbackdrop-filter可以设置多种类型的滤镜:模糊blur、亮度brightness、对比度contrast我们使用blur()设置模糊。backdrop-filter与filter非常类似,可以取的值都是一样的,但是一个是作用于整个元素,一个是只作用于元素后面的区域。backdrop-filter与filter对比我们使用backdrop-filter与filter同时实现一个毛玻璃效果作为对比,代码如下:复制代码 Normal filter backdrop-filter <div class="bg1"></div> export default { name: "filter1" } .bg { width: 40%; background: url('~@/assets/山水画.png');& > div { display: flex; align-items: center; justify-content: center; width: 200px; height: 100px; //为了看到效果,必须使元素的背景至少部分透明 background: rgba(255, 255, 255, .7); }.g-filter {filter: blur(6px);} .g-backdrop-filter {backdrop-filter: blur(6px);}}.bg1 { width: 40%; background: url('~@/assets/山水画.png');}复制代码效果如下:如果元素或其背景没有部分透明,修改上面的代码:background: rgba(255, 255, 255, 1);效果如下: ` ` 此时没有磨砂效果。
2025年02月03日
1 阅读
0 评论
0 点赞
2024-11-24
Linux系统压缩目录下的图片
#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH #!/bin/bash # 查找目录及子目录的图片文件(jpg,gif,png),将大于某值的图片进行压缩处理 # Config folderPath='/www/wwwroot/salon/attachment/behram_pic' # 图片目录路径 maxSize='100KB' # 图片尺寸允许值 maxWidth=640 # 图片最大宽度 maxHeight=500 # 图片最大高度 quality=80 # 图片质量 # 压缩处理 # Param $folderPath 图片目录 function compress(){ folderPath=$1 if [ -d "$folderPath" ]; then for file in $(find "$folderPath" \( -name "*.jpg" -or -name "*.gif" -or -name "*.png" \) -type f -size +"$maxSize" ); do echo $file # 调用imagemagick resize图片 $(convert -resize "$maxWidth"x"$maxHeight" "$file" -quality "$quality" -colorspace sRGB "$file") done else echo "$folderPath not exists" fi } # 执行compress compress "$folderPath" exit 0 echo "----------------------------------------------------------------------------" endDate=`date +"%Y-%m-%d %H:%M:%S"` echo "★[$endDate] Successful" echo "----------------------------------------------------------------------------"
2024年11月24日
7 阅读
0 评论
0 点赞
PHP图片判断大小压缩代码
2024年11月24日
8 阅读
0 评论
0 点赞
2024-11-24
//图片压缩开始了 if($fileInfo['type']=='image/jpeg' || $fileInfo['type']=='image/png' || $fileInfo['type']=='image/gif' || $fileInfo['type']=='image/jpg' || $fileInfo['type']=='image/webp') { if($fileInfo['type']=='image/png' || $fileInfo['type']=='image/gif'){ $this->ImageToJPG($img_path, $img_path, $imagewidth , $imageheight); } require_once VENDOR_PATH.'topthink/think_image.php'; $image = \think\Image::open($img_path); if($imagewidth < 720){ if($imagewidth > $imageheight){ $image->thumb($imagewidth, $imageheight)->save($img_path); //file_put_contents(ROOT_PATH.'/1.txt', print_r($imagewidth, true)); }else{ $image->thumb($imagewidth, $imagewidth, 3)->save($img_path); $imageheight = $imagewidth; } }else{ //file_put_contents(ROOT_PATH.'/kiqik.txt', print_r('kiqik', true)); if($imagewidth > $imageheight){ $zoom = $imagewidth / 720; $image->thumb(720, $imageheight/$zoom)->save($img_path); $imageheight = $imageheight/$zoom; $imagewidth = 720; }else{ $image->thumb(720, 720, 3)->save($img_path); $imagewidth = 720; $imageheight = 720; } } clearstatcache(); $fileInfo['size'] = filesize($img_path); } //图片压缩结束了