Sam Wong

Results 6 comments of Sam Wong

PNG图片我是选择图片文件上传的。 @xiebruce 今天一直无法上传,Cloudinary无法上传,我切换到阿里云OSS测试也不行,我注释掉`error_reporting(0);`后看到有如下错误信息: ![image](https://user-images.githubusercontent.com/6895399/72142881-a3a5fd00-33d0-11ea-9a13-9e8e0d9db3c2.png) 域名解析正常, ![image](https://user-images.githubusercontent.com/6895399/72143303-70b03900-33d1-11ea-9dab-1be85a25f0c1.png) ![1578650280827](https://user-images.githubusercontent.com/6895399/72144833-2bd9d180-33d4-11ea-8074-f72a358206b5.jpg) 我对照`https://curl.haxx.se/libcurl/c/libcurl-errors.html`看了下错误码,如下: ![image](https://user-images.githubusercontent.com/6895399/72143140-229b3580-33d1-11ea-96da-4243b2e7a1a8.png) ![image](https://user-images.githubusercontent.com/6895399/72143159-2af37080-33d1-11ea-89e7-9a7654ad56e6.png)

@xiebruce 我查了下,我本地测试的那张PNG图片,alpha通道未启用(一个像素RGB,3个字节),但是在压缩时设置了Alpha通道(使用RGBA,4个字节)所以压缩后文件大小变大了。 原始PNG图片详细信息: ![image](https://user-images.githubusercontent.com/6895399/72342172-e9cbcb00-3706-11ea-84df-d6244ce98769.png) 压缩后PNG图片信息: ![image](https://user-images.githubusercontent.com/6895399/72342530-9908a200-3707-11ea-9f21-5efac21c35e4.png) 看了下,源码中涉及图片加载、创建、缩放、裁剪等处调用方法`imagesavealpha`,并将Alpha通道保saveflag设置成了true。 ![image](https://user-images.githubusercontent.com/6895399/72342686-09172800-3708-11ea-8fcf-5c77e4a76a52.png) 另外,看到源码中EasyImage加载图片方法中imagealphablending方法和imagesavealpha方法顺序是不是反了,需要调整 ![image](https://user-images.githubusercontent.com/6895399/72343015-dde10880-3708-11ea-89bf-3dc13d424507.png) 参考如下: ![image](https://user-images.githubusercontent.com/6895399/72343095-0bc64d00-3709-11ea-82c1-8cef40af8bab.png) ### 参考链接: - [PHP中文手册——imagesavealpha](https://php.golaravel.com/function.imagesavealpha.html) - [PHP实现生成透明背景的PNG缩略图](https://www.php.cn/php-weizijiaocheng-56398.html)

不是所有的图片都有Alpha通道,能否在设置Alpha通道时判断原始图片是否启用了Alpha通道,如果未启用则加载图片压缩等处理后也不设置alpha通道。

> 权限问题,请保持以下三个相同,就没问题了 > > * 1.php-fpm运行用户和组 > * 2.nginx运行用户和组 > * 3.PicUploader所属用户和组 @xiebruce 再请教下,docker容器内运行时,每个容器的用户和组都是各自容器内的,例如php-fpm是容器php的用户组www-data,nginx是容器nginx的用户组nginx,PicUploader是宿主机的用户组为apprun,这三个感觉没法统一,有其他方法吗

@xiebruce 我试了好像不行,因为容器内的用户和组是容器镜像中的/etc/passwd和/etc/group,不是宿主机的/etc/passwd,可以基于官方镜像在自定义Dockfile中使用useradd增加用户,但也只能保证名字一样,uid和gid是不同的。

windows 7 is also like this. **Environment** - Windows 7 64bit - Node v8.11.3 - npm 5.6.0