我正在尝试创建一个图库.我想用PHP Image Magick尝试这次.
上传文件时,我希望将其大小调整为1024x724.如果图像是垂直的(宽度<高度)我希望它安装在图像的中心和透明背景(或者如果不可能是白色)两侧应该是空白的,所以图像总是1024x724和方面无线电广播.
如果图像是水平的(宽度>高度),则同样适用.
到目前为止,这是我的代码:
$img = new Imagick($targetFile);
$img->scaleImage(1024,724);
$img->setGravity(imagick::GRAVITY_CENTER);
$img->setImageBackgroundColor('white');
$img->extentImage(1024,724,0,0);
$img->writeImage($targetFile);
$img = new Imagick($targetFile);
$img->scaleImage(150,150);
$img->setGravity(imagick::GRAVITY_CENTER);
$img->setImageBackgroundColor('white');
$img->extentImage(150,150,0,0);
$img->writeImage($targetThumb);
Run Code Online (Sandbox Code Playgroud) 我尝试traefik在GKE(google cloud kubernetes引擎)上安装为入口控制器,并且在尝试时:
kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-rbac.yaml
Run Code Online (Sandbox Code Playgroud)
我有这个错误:
来自服务器的错误(禁止):创建“ https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-rbac.yaml时出错“ :: clusterroles.rbac.authorization.k8s.io“ traefik-ingress-controller”被禁止:尝试授予额外的特权:[PolicyRule {APIGroups:[“”],资源:[“服务”],动词:[“ get “]} PolicyRule {APIGroups:[”“],资源:[” services“],动词:[” list“]} PolicyRule {APIGroups:[”“],资源:[” services“],动词:[”监视“]} PolicyRule {APIGroups:[”“],资源:[” endpoints]],动词:[“ get”]} PolicyRule {APIGroups:[“”],资源:[“ endpoints”],动词:[“列表“]} PolicyRule {APIGroups:[”“],资源:[”端点“],动词:[” watch“]} PolicyRule {APIGroups:[”“],资源:[” secrets“],动词:[” get “]} PolicyRule {APIGroups:[“”],资源:[“ secrets”],动词:[“ list”]} PolicyRule {APIGroups:[“”],资源:[“ secrets”],动词:[“ watch”]} PolicyRule {APIGroups: [“扩展名”],资源:[“入口”],动词:[“ get”]} PolicyRule {APIGroups:[“扩展名”],资源:[“入口”],动词:[“列表”]} PolicyRule { APIGroups:[“扩展名”],资源:[“ ingresses”],动词:[“ watch”]}] user=&{IzoPi4a@gmail.com [system:authenticated] map [user-assertion.cloud.google.com :[ADKE0IBz9kwSuZRZkfbLil8iC / ijcmJJmuys2DvDGxoxQ5yP6Pdq1IQs3JRwDmd / lWm2vGdMXGB4h1QKiwx + 3uV2ciTb / oQNtkthBvONnVp4fJGOSW1S + 8O8dqvoUNRLNeB5gADNn1TKEYoB + JvRkjrkTOxtIh7rPugLaP5Hp7thWft9xwZqF9U4fgYHnPjCdRgvMrDvGIK8z7ONljYuStpWdJDu7LrPpT0L]]} …
google-cloud-platform kubernetes google-kubernetes-engine traefik
CREATE TABLE `products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`brand` int(11) DEFAULT NULL,
`shown` tinyint(4) DEFAULT '1',
PRIMARY KEY (`id`),
KEY `fk_products_brandId_idx` (`brand`),
KEY `pk_products_shown` (`shown`),
CONSTRAINT `fk_products_brandId` FOREIGN KEY (`brand`) REFERENCES `brands` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_products_categoryId` FOREIGN KEY (`category`) REFERENCES `categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
Run Code Online (Sandbox Code Playgroud)
我有这个“显示”字段,用于标记已删除的记录(如果用户删除记录,则不会删除;这些字段设置为值 0)。
所以我所有的查询或多或少都是这样的:
"SELECT * FROM products WHERE brand = 1 AND shown = …Run Code Online (Sandbox Code Playgroud)