From 21aa1fbb7dfb0d446dcf33a3fa53ab2e80f28d30 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 3 Sep 2023 10:34:35 +0200 Subject: [PATCH] added identicons --- README.md | 3 +- .../identicon/identicon.controller.php | 38 ++++++++++++++++ lib/composer.json | 3 +- lib/composer.lock | 45 ++++++++++++++++++- 4 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 content-controllers/identicon/identicon.controller.php diff --git a/README.md b/README.md index 91c854a..dc3a184 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,9 @@ docker run -d -p 8080:80 --name=pictshare ghcr.io/hascheksolutions/pictshare Then open http://localhost:8080 in your browser -## New Features in v2 +## New Features +- Generate identicons based on strings in the URL [example1](https://pictshare.net/identicon/example1) [example2](https://pictshare.net/identicon/example2) - Generate placeholder images by specifying the size in the URL. [example](https://pictshare.net/placeholder/555x250/color-white-blue) - Added support for external storage - [Encryption of files in external storage](/rtfm/ENCRYPTION.md) diff --git a/content-controllers/identicon/identicon.controller.php b/content-controllers/identicon/identicon.controller.php new file mode 100644 index 0000000..894e990 --- /dev/null +++ b/content-controllers/identicon/identicon.controller.php @@ -0,0 +1,38 @@ +setBackgroundColor(Color::parseHex('#EEEEEE')); + + $identicon = new Identicon(new MD5Preprocessor(), $generator); + + $icon = $identicon->getIcon($url[0]); + + header('Content-type: image/svg+xml'); + echo $icon; + } + + public function handleUpload($tmpfile,$hash=false) + { + return array('status'=>'err','hash'=>$hash,'reason'=>'Cannot upload to Identicons'); + } + + +} \ No newline at end of file diff --git a/lib/composer.json b/lib/composer.json index e469785..96b2685 100644 --- a/lib/composer.json +++ b/lib/composer.json @@ -1,5 +1,6 @@ { "require": { - "aws/aws-sdk-php": "^3.33" + "aws/aws-sdk-php": "^3.33", + "bitverse/identicon": "^1.1" } } diff --git a/lib/composer.lock b/lib/composer.lock index b28f649..669a171 100644 --- a/lib/composer.lock +++ b/lib/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ef2729074d82a701a7df40571d9210ea", + "content-hash": "55774a7c38a82a511932ca4321acb7f8", "packages": [ { "name": "aws/aws-sdk-php", @@ -91,6 +91,49 @@ }, "time": "2017-08-21T20:34:30+00:00" }, + { + "name": "bitverse/identicon", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/bitverseio/identicon.git", + "reference": "65a50a5a8bd86b3591795937f9652b2e9075626c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bitverseio/identicon/zipball/65a50a5a8bd86b3591795937f9652b2e9075626c", + "reference": "65a50a5a8bd86b3591795937f9652b2e9075626c", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kuba Birecki", + "email": "kuba.birecki@bitverse.io" + } + ], + "description": "A PHP library for generating identicons.", + "support": { + "issues": "https://github.com/bitverseio/identicon/issues", + "source": "https://github.com/bitverseio/identicon/tree/master" + }, + "time": "2015-11-01T21:19:42+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "6.5.8",