-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
前后端代码做了很多优化,增加了功能说明,后端性能提升,减少内存占用,加了一些注释。 #10
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以看看
require_once("sandphoto.inc"); | ||
|
||
$filename = "/var/www/sandcomp/apache/htdocs/sandphoto/sample.jpg"; | ||
$temp_path = "/var/www/sandcomp/apache/htdocs/sandphoto/temp"; | ||
$temp_path = __DIR__ . '/temp'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改成动态地址,避免写死目录,换地地方部署不需要创建对应目录,支持部署多个应用
$p->set_target_size($tw, $th); | ||
$n = $p->put_photo($filename, $bgcolorid); | ||
$p->preview_image($cachePath); | ||
exec('/usr/bin/optipng ' . $cachePath . " >/dev/null 2>/dev/null"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exec相对system来说安全一点
$pos_x = $w_start + ($this->target_width + $GAP) * $i; | ||
for ($j = 0; $j < $hn; $j++) { | ||
$pos_y = $h_start + ($this->target_height + $GAP) * $j; | ||
imagecopy($this->im, $temp, $pos_x, $pos_y, 0, 0, $this->target_width, $this->target_height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
性能提升,内存占用降低
No description provided.