Code Monkey home page Code Monkey logo

kirby-colorextractor's People

Contributors

johannschopplich avatar moritzebeling avatar simonknebl avatar sylvainjule avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kirby-colorextractor's Issues

When uploading an svg file to the panel

When uploading a svg file to the panel it throws an error: imagecreatefromstring(): Data is not in a recognized format

same with a png file: file_get_contents(http://localhost/peak/media/site/-772678704-1544528814/capture-1x0-q90.png): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found

These issues come up since I've updated to the latest v3 nightly build 2018-12-10

blueprint setup:

sections:
  images:
    type: files
    layout: list
    template: image
    info: "{{ file.dimensions }}"

error
error

Request: Store dominant and average colors

I would find it useful to be able to generate both the dominant and average color of an image, rather than having to choose between one or the other.

I'd be fine if the names were more explicit, but if they were customizable that'd be cool

$file->dominantColor() and $file->averageColor() maybe?

PHP fatal error in console

I tested the plugin in plainkit and on a website. It throws an error in the console after displaying a misleading message on the panel:
image
because the file seems uploaded after that.

I tested on Kirby 3.7 & 3.8.1 as I remember, it was working for 3.6.
UPDATE : It runs well on PHP 7.X but doesn't on PHP 8.X

The kirby console gives a better hint :

PHP Fatal error:  During inheritance of Countable: Uncaught Whoops\Exception\ErrorException: Return type of League\ColorExtractor\Palette::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/username/Downloads/plainkit-main/kirby/vendor/league/color-extractor/src/League/ColorExtractor/Palette.php:13
Stack trace:
#0 /Users/username/Downloads/plainkit-main/kirby/vendor/league/color-extractor/src/League/ColorExtractor/Palette.php(5): Whoops\Run->handleError(8192, 'Return type of ...', '/Users/username...', 13)
#1 /Users/username/Downloads/plainkit-main/kirby/vendor/composer/ClassLoader.php(571): include('/Users/username...')
#2 /Users/username/Downloads/plainkit-main/kirby/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/Users/username...')
#3 /Users/username/Downloads/plainkit-main/site/plugins/kirby-colorextractor-master/lib/colorextractor.php(33): Composer\Autoload\ClassLoader->loadClass('League\\ColorExt...')
#4 /Users/username/Downloads/plainkit-main/site/plugins/kirby-colorextractor-master/lib/colorextractor.php(19): SylvainJule\ColorExtractor::processImage(Object(Kirby\Cms\File), 300, NULL)
#5 /Users/username/Downloads/plainkit-main/site/plugins/kirby-colorextractor-master/index.php(58): SylvainJule\ColorExtractor::extractColor(Object(Kirby\Cms\File), 'dominant', NULL)
#6 [internal function]: Kirby\Cms\File->{closure}()
#7 /Users/username/Downloads/plainkit-main/kirby/src/Cms/HasMethods.php(43): Closure->call(Object(Kirby\Cms\File))
#8 /Users/username/Downloads/plainkit-main/kirby/src/Cms/File.php(109): Kirby\Cms\File->callMethod('extractColor', Array)
#9 /Users/username/Downloads/plainkit-main/site/plugins/kirby-colorextractor-master/index.php(44): Kirby\Cms\File->__call('extractColor', Array)
#10 [internal function]: Kirby\Cms\App->{closure}(Object(Kirby\Cms\File))
#11 /Users/username/Downloads/plainkit-main/kirby/src/Toolkit/Controller.php(50): Closure->call(Object(Kirby\Cms\App), Object(Kirby\Cms\File))
#12 /Users/username/Downloads/plainkit-main/kirby/src/Cms/Event.php(165): Kirby\Toolkit\Controller->call(Object(Kirby\Cms\App), Array)
#13 /Users/username/Downloads/plainkit-main/kirby/src/Cms/App.php(1712): Kirby\Cms\Event->call(Object(Kirby\Cms\App), Object(Kirby\Toolkit\Controller))
#14 /Users/username/Downloads/plainkit-main/kirby/src/Cms/FileActions.php(130): Kirby\Cms\App->trigger('file.create:aft...', Array)
#15 /Users/username/Downloads/plainkit-main/kirby/src/Cms/FileActions.php(232): Kirby\Cms\File->commit('create', Array, Object(Closure))
#16 /Users/username/Downloads/plainkit-main/kirby/src/Cms/HasFiles.php(69): Kirby\Cms\File::create(Array)
#17 /Users/username/Downloads/plainkit-main/kirby/config/api/routes/files.php(47): Kirby\Cms\Site->createFile(Array)
#18 /Users/username/Downloads/plainkit-main/kirby/src/Api/Api.php(702): Kirby\Cms\Api->{closure}('/private/var/fo...', 'portrait en bus...')
#19 /Users/username/Downloads/plainkit-main/kirby/config/api/routes/files.php(49): Kirby\Api\Api->upload(Object(Closure))
#20 [internal function]: Kirby\Cms\Api->{closure}('site')
#21 /Users/username/Downloads/plainkit-main/kirby/src/Api/Api.php(181): Closure->call(Object(Kirby\Cms\Api), 'site')
#22 /Users/username/Downloads/plainkit-main/kirby/src/Cms/Api.php(46): Kirby\Api\Api->call('site/files', 'POST', Array)
#23 /Users/username/Downloads/plainkit-main/kirby/src/Api/Api.php(503): Kirby\Cms\Api->call('site/files', 'POST', Array)
#24 /Users/username/Downloads/plainkit-main/kirby/config/routes.php(46): Kirby\Api\Api->render('site/files', 'POST', Array)
#25 [internal function]: Kirby\Http\Route->{closure}('site/files')
#26 /Users/username/Downloads/plainkit-main/kirby/src/Http/Router.php(120): Closure->call(Object(Kirby\Http\Route), 'site/files')
#27 /Users/username/Downloads/plainkit-main/kirby/src/Cms/App.php(340): Kirby\Http\Router->call('api/site/files', 'POST')
#28 /Users/username/Downloads/plainkit-main/kirby/src/Cms/App.php(1242): Kirby\Cms\App->call('api/site/files', 'POST')
#29 /Users/username/Downloads/plainkit-main/index.php(5): Kirby\Cms\App->render()
#30 /Users/username/Downloads/plainkit-main/kirby/router.php(14): require('/Users/username...')
#31 {main} in /Users/username/Downloads/plainkit-main/kirby/vendor/league/color-extractor/src/League/ColorExtractor/Palette.php on line 5
[Mon Nov 21 10:49:18 2022] Whoops\Exception\ErrorException: During inheritance of Countable: Uncaught Whoops\Exception\ErrorException: Return type of League\ColorExtractor\Palette::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/username/Downloads/plainkit-main/kirby/vendor/league/color-extractor/src/League/ColorExtractor/Palette.php:13
Stack trace:
#0 /Users/username/Downloads/plainkit-main/kirby/vendor/league/color-extractor/src/League/ColorExtractor/Palette.php(5): Whoops\Run->handleError(8192, 'Return type of ...', '/Users/username...', 13)
#1 /Users/username/Downloads/plainkit-main/kirby/vendor/composer/ClassLoader.php(571): include('/Users/username...')
#2 /Users/username/Downloads/plainkit-main/kirby/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/Users/username...')
#3 /Users/username/Downloads/plainkit-main/site/plugins/kirby-colorextractor-master/lib/colorextractor.php(33): Composer\Autoload\ClassLoader->loadClass('League\\ColorExt...')
#4 /Users/username/Downloads/plainkit-main/site/plugins/kirby-colorextractor-master/lib/colorextractor.php(19): SylvainJule\ColorExtractor::processImage(Object(Kirby\Cms\File), 300, NULL)
#5 /Users/username/Downloads/plainkit-main/site/plugins/kirby-colorextractor-master/index.php(58): SylvainJule\ColorExtractor::extractColor(Object(Kirby\Cms\File), 'dominant', NULL)
#6 [internal function]: Kirby\Cms\File->{closure}()
#7 /Users/username/Downloads/plainkit-main/kirby/src/Cms/HasMethods.php(43): Closure->call(Object(Kirby\Cms\File))
#8 /Users/username/Downloads/plainkit-main/kirby/src/Cms/File.php(109): Kirby\Cms\File->callMethod('extractColor', Array)
#9 /Users/username/Downloads/plainkit-main/site/plugins/kirby-colorextractor-master/index.php(44): Kirby\Cms\File->__call('extractColor', Array)
#10 [internal function]: Kirby\Cms\App->{closure}(Object(Kirby\Cms\File))
#11 /Users/username/Downloads/plainkit-main/kirby/src/Toolkit/Controller.php(50): Closure->call(Object(Kirby\Cms\App), Object(Kirby\Cms\File))
#12 /Users/username/Downloads/plainkit-main/kirby/src/Cms/Event.php(165): Kirby\Toolkit\Controller->call(Object(Kirby\Cms\App), Array)
#13 /Users/username/Downloads/plainkit-main/kirby/src/Cms/App.php(1712): Kirby\Cms\Event->call(Object(Kirby\Cms\App), Object(Kirby\Toolkit\Controller))
#14 /Users/username/Downloads/plainkit-main/kirby/src/Cms/FileActions.php(130): Kirby\Cms\App->trigger('file.create:aft...', Array)
#15 /Users/username/Downloads/plainkit-main/kirby/src/Cms/FileActions.php(232): Kirby\Cms\File->commit('create', Array, Object(Closure))
#16 /Users/username/Downloads/plainkit-main/kirby/src/Cms/HasFiles.php(69): Kirby\Cms\File::create(Array)
#17 /Users/username/Downloads/plainkit-main/kirby/config/api/routes/files.php(47): Kirby\Cms\Site->createFile(Array)
#18 /Users/username/Downloads/plainkit-main/kirby/src/Api/Api.php(702): Kirby\Cms\Api->{closure}('/private/var/fo...', 'portrait en bus...')
#19 /Users/username/Downloads/plainkit-main/kirby/config/api/routes/files.php(49): Kirby\Api\Api->upload(Object(Closure))
#20 [internal function]: Kirby\Cms\Api->{closure}('site')
#21 /Users/username/Downloads/plainkit-main/kirby/src/Api/Api.php(181): Closure->call(Object(Kirby\Cms\Api), 'site')
#22 /Users/username/Downloads/plainkit-main/kirby/src/Cms/Api.php(46): Kirby\Api\Api->call('site/files', 'POST', Array)
#23 /Users/username/Downloads/plainkit-main/kirby/src/Api/Api.php(503): Kirby\Cms\Api->call('site/files', 'POST', Array)
#24 /Users/username/Downloads/plainkit-main/kirby/config/routes.php(46): Kirby\Api\Api->render('site/files', 'POST', Array)
#25 [internal function]: Kirby\Http\Route->{closure}('site/files')
#26 /Users/username/Downloads/plainkit-main/kirby/src/Http/Router.php(120): Closure->call(Object(Kirby\Http\Route), 'site/files')
#27 /Users/username/Downloads/plainkit-main/kirby/src/Cms/App.php(340): Kirby\Http\Router->call('api/site/files', 'POST')
#28 /Users/username/Downloads/plainkit-main/kirby/src/Cms/App.php(1242): Kirby\Cms\App->call('api/site/files', 'POST')
#29 /Users/username/Downloads/plainkit-main/index.php(5): Kirby\Cms\App->render()
#30 /Users/username/Downloads/plainkit-main/kirby/router.php(14): require('/Users/username...')
#31 {main} in /Users/username/Downloads/plainkit-main/kirby/vendor/league/color-extractor/src/League/ColorExtractor/Palette.php:5
Stack trace:
#0 /Users/username/Downloads/plainkit-main/kirby/vendor/filp/whoops/src/Whoops/Run.php(486): Whoops\Run->handleError(1, 'During inherita...', '/Users/username...', 5)
#1 [internal function]: Whoops\Run->handleShutdown()
#2 {main}
[Mon Nov 21 10:49:18 2022] Whoops\Exception\ErrorException: Cannot modify header information - headers already sent by (output started at /Users/username/Downloads/plainkit-main/kirby/vendor/league/color-extractor/src/League/ColorExtractor/Palette.php:5) in /Users/username/Downloads/plainkit-main/kirby/src/Http/Response.php:270
Stack trace:
#0 [internal function]: Whoops\Run->handleError(2, 'Cannot modify h...', '/Users/username...', 270)
#1 /Users/username/Downloads/plainkit-main/kirby/src/Http/Response.php(270): header('Content-Type:ap...')
#2 /Users/username/Downloads/plainkit-main/kirby/src/Http/Response.php(94): Kirby\Http\Response->send()
#3 /Users/username/Downloads/plainkit-main/kirby/src/Cms/AppErrors.php(141): Kirby\Http\Response->__toString()
#4 /Users/username/Downloads/plainkit-main/kirby/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php(50): Kirby\Cms\App->Kirby\Cms\{closure}(Object(Whoops\Exception\ErrorException), Object(Whoops\Exception\Inspector), Object(Whoops\Run))
#5 /Users/username/Downloads/plainkit-main/kirby/vendor/filp/whoops/src/Whoops/Run.php(370): Whoops\Handler\CallbackHandler->handle(Object(Whoops\Exception\ErrorException))
#6 /Users/username/Downloads/plainkit-main/kirby/vendor/filp/whoops/src/Whoops/Run.php(454): Whoops\Run->handleException(Object(Whoops\Exception\ErrorException))
#7 /Users/username/Downloads/plainkit-main/kirby/vendor/filp/whoops/src/Whoops/Run.php(486): Whoops\Run->handleError(1, 'During inherita...', '/Users/username...', 5)
#8 [internal function]: Whoops\Run->handleShutdown()
#9 {main}
[Mon Nov 21 10:49:18 2022] PHP Warning:  Cannot modify header information - headers already sent by (output started at /Users/username/Downloads/plainkit-main/kirby/vendor/league/color-extractor/src/League/ColorExtractor/Palette.php:5) in /Users/username/Downloads/plainkit-main/kirby/src/Http/Response.php on line 270

PHP Notice: Use of undefined constant DS

I'm getting the error on a fresh install of kirby beta6.1, running in arch linux docker container.

adding if (!defined('DS')) define('DS', DIRECTORY_SEPARATOR); to index.php before vendors get loaded via the autoloader fixed it for me.

Image must be a gd resource

Uploaded images (jpg) are giving me the following error: Image must be a gd resource

To reproduce: Make photo with iPhone, upload in panel. PNG's not working as well.

Kirby 3.0

[K4] 4.0 Compatibility

Kirby\Cms\File::{closure}(): Return value must be of type Kirby\Cms\Field, Kirby\Content\Field returned
/site/plugins/kirby-colorextractor-master/index.php:60

Kirby 4.0.0-rc.4
PHP 8.1.23

Call to a member function find() on array

when i try to 'Extract missing colors' using the field,
after the message: 'There are 3 images without any color extracted, do you want to process them now?' I get:
'3 images processed, with 3 error(s)'
Call to a member function find() on array (x 3)

Uploading a single image seems to work ok - I get the color value stoered for that, it's jsut for multiples it seems.

code: 500
exception: "Error"
file: "plugins/colorextractor/lib/routes.php"
line: 10
message: "Call to a member function find() on array"
route: "colorextractor/process-image"

versions:
"getkirby/cms": "3.1.2",
"sylvainjule/colorextractor": "1.0.1"

Field method toColor('average') returns the dominant color in extract mode => 'both'

I am using 'sylvainjule.colorextractor.mode' => 'both' to extract both the dominant and the average color.

It seems to work and $image->color() returns a comma-separated list with both colors:

Kirby\Cms\Field Object
(
    [color] => #5F99A5,#7B8992
)

However when I try using the field methods $image->color()->toColor('dominant') and $image->color()->toColor('average') I only get the dominant color as a result in both cases.

Choosing between dominant/average

Hello,
First of all thanks for the great work on this.
I was wondering how nice would be to allow dominant/average color options to coexist in the same blueprint, allowing to choose between those two.
Is this something that can be achieved easily?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.