aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/api/engine-cyclic/components/favicon.php
diff options
context:
space:
mode:
authorGitea <gitea@fake.local>2021-11-10 17:53:50 +0100
committerGitea <gitea@fake.local>2021-11-10 17:53:50 +0100
commit8fabf77b2a7720a357c63817c07035a9908818a0 (patch)
treed689fcac1403e2473010fe80bc337599a78c21a4 /Neutron-trunk/api/engine-cyclic/components/favicon.php
parent7b4af63a90a726b98a59b83e53f040a7a566a11d (diff)
downloadelectrode-8fabf77b2a7720a357c63817c07035a9908818a0.tar.gz
electrode-8fabf77b2a7720a357c63817c07035a9908818a0.tar.bz2
electrode-8fabf77b2a7720a357c63817c07035a9908818a0.zip
Update
Diffstat (limited to 'Neutron-trunk/api/engine-cyclic/components/favicon.php')
-rw-r--r--Neutron-trunk/api/engine-cyclic/components/favicon.php88
1 files changed, 0 insertions, 88 deletions
diff --git a/Neutron-trunk/api/engine-cyclic/components/favicon.php b/Neutron-trunk/api/engine-cyclic/components/favicon.php
deleted file mode 100644
index 3d078a1..0000000
--- a/Neutron-trunk/api/engine-cyclic/components/favicon.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
- class CircleCrop
- {
-
- private $src_img;
- private $src_w;
- private $src_h;
- private $dst_img;
- private $dst_w;
- private $dst_h;
-
- public function __construct($img, $dstWidth, $dstHeight)
- {
- $this->src_img = $img;
- $this->src_w = imagesx($img);
- $this->src_h = imagesy($img);
- $this->dst_w = $dstWidth;
- $this->dst_h = $dstHeight;
- }
-
- public function __destruct()
- {
- if (is_resource($this->dst_img))
- {
- imagedestroy($this->dst_img);
- }
- }
-
- public function display()
- {
- imagepng($this->dst_img, $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/favicon.png");
- return $this;
- }
-
- public function reset()
- {
- if (is_resource(($this->dst_img)))
- {
- imagedestroy($this->dst_img);
- }
- $this->dst_img = imagecreatetruecolor($this->dst_w, $this->dst_h);
- imagecopy($this->dst_img, $this->src_img, 0, 0, 0, 0, $this->dst_w, $this->dst_h);
- return $this;
- }
-
- public function size($dstWidth, $dstHeight)
- {
- $this->dst_w = $dstWidth;
- $this->dst_h = $dstHeight;
- return $this->reset();
- }
-
- public function crop()
- {
- $this->reset();
-
- $mask = imagecreatetruecolor($this->dst_w, $this->dst_h);
- $maskTransparent = imagecolorallocate($mask, 255, 0, 255);
- imagecolortransparent($mask, $maskTransparent);
- imagefilledellipse($mask, $this->dst_w / 2, $this->dst_h / 2, $this->dst_w, $this->dst_h, $maskTransparent);
-
- imagecopymerge($this->dst_img, $mask, 0, 0, 0, 0, $this->dst_w, $this->dst_h, 100);
-
- $dstTransparent = imagecolorallocate($this->dst_img, 255, 0, 255);
- imagefill($this->dst_img, 0, 0, $dstTransparent);
- imagefill($this->dst_img, $this->dst_w - 1, 0, $dstTransparent);
- imagefill($this->dst_img, 0, $this->dst_h - 1, $dstTransparent);
- imagefill($this->dst_img, $this->dst_w - 1, $this->dst_h - 1, $dstTransparent);
- imagecolortransparent($this->dst_img, $dstTransparent);
-
- return $this;
- }
-
- }
-
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon-uncomp.png")) {
- $path = $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon-uncomp.png";
- } else {
- $path = $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon.png";
- }
-
- $image = imagecreatefrompng($path);
-
- $width = imagesx($image);
- $height = imagesy($image);
- $crop = new CircleCrop($image,$width,$height);
- $crop->crop()->display(); \ No newline at end of file