//参数1 文件名 参数2 缩放比例
function _thumb($_filename,$_percent){
ob_clean();
//生成png标头文件
header('Content-type:image/png');
$_n=explode('.', $_filename);
//获取文件的信息,宽和高
list($_width,$_height)=getimagesize($_filename);
//生成缩略后的大小
$_new_width=$_width*$_percent;
$_new_height=$_height*$_percent;
//按照新的大小创建微缩画布
$_new_image=imagecreatetruecolor($_new_width, $_new_height);
//按照已经有的图片创建一个画布[按照图片类型]
switch($_n[1]){
case 'jpg':$_image=imagecreatefromjpeg($_filename);
break;
case 'png':$_image=imagecreatefrompng($_filename);
break;
case 'gif':$_image=imagecreatefromgif($_filename);
break;
}
//将原来的图复制到新的图片上
imagecopyresampled($_new_image, $_image, 0, 0, 0, 0, $_new_width, $_new_height, $_width, $_height);
//输出图片
imagepng($_new_image);
//销毁新资源句柄
imagedestroy($_new_image);
//销毁原资源句柄
imagedestroy($_image);
} 先在centos安装openssl,然后开始://生成私钥openssl genrsa -out rsa_private_key.pem 1024//生成公钥openssl rsa -in rsa_private_key.pem&...
重构框架的时候想要考虑支持下cli模式,于是参考了thinkphp的底层。/** * 获取应用根目录 * @return string */ public static function getRootP...
Redis提供了发布订阅功能,可以用于消息的传输,Redis的发布订阅机制包括三个部分,发布者(publisher),订阅者(subscriber)和频道(channel)。 发布者和订阅者都是Redis客户端,Channel则为Redis服务器端,发布者将消息发送到某个的频道,订阅了这个...
<?php //php7+ define('CONFIG', [ 'MYSQL' => '127.0.0.1',  ...
经常我们下载国外资源容易被墙,可以通过php脚本获取远程文件流然后输出给我们的浏览器来下载。<?php //设置下载文件的url $url = 'https://mirrors.huaweicloud.com/ubuntukylin/ubuntukylin-19....
本教程使用的定时任务基于EasyTak实现,EasyTask官方参考文档:https://gitee.com/392223903/EasyTask首先我们必须明白PHP的定时器只能基于CLI命令行形式运行...