skymvc/library/cls_image.php
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/*
图片处理
缩略图及打水印
*/
class image{
public $quality=75;
function __construct(){
}
/**
缩略图函数
*/
function makethumb($dstimg,$img,$dstw,$dsth=999,$all=false)
{
if(substr($img,0,5)!="http:" && substr($img,0,6)!="https:"){
$img=ROOT_PATH."/".$img;
}
if(!file_exists($img))
{
return false;
}
list($width,$height) = getimagesize($img);
$percent=$dstw/$width;//固定宽度
/*
if($width>$height)
{
$percent=$dstw/$width;
}else
{
$percent=$dsth/$height;
}*/
$new_width = $width * $percent;
$new_height = $height * $percent;
if($all){
$new_width=$dstw;
$new_height=$dsth;
if($all==1){
if($height>$width){
$height=$width;
}else{
$width=$height;
}
}else{
$height=$new_height;
$width=$new_width;
}
}
$im = imagecreatetruecolor($new_width, $new_height);
$alpha = imagecolorallocatealpha($im, 255, 255, 255, 127);
imagefill($im, 0, 0, $alpha);
$imgtype=$this->getimgtype($img);
//$image = $this->imagecreatefrom($img,$imgtype);
$image=imagecreatefromstring(file_get_contents($img));
imagecopyresampled($im, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagesavealpha($im, true);
后面还有 260 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。