Giter Club home page Giter Club logo

Comments (8)

mullema avatar mullema commented on May 29, 2024 1

They are two properties in the Darkroom class. Whenever you call the Darkroom::factory it will return what is set in those properties. The only important thing is that you set your properties before you call Darkroom::factory.
You are not doing that manually in your plugin, but it is called in the thumbs method. If you insert the property definition somewhere before you return $this->thumb() you will be fine.

from kirby-focus.

mullema avatar mullema commented on May 29, 2024 1

You are right, it does not work as I suggested. I don't quite understand why....
Unfortunately are thumbs components overwriting each other. The last one declared will be the one used.

We could at least make our two plugins work together:

  • You omit using the thumbs component.
  • You declare your Darkroom::$types globally (as before).
  • I reset the Darkroom::$types after cliping in my plugin.

But that does not save you from other plugins messing with Darkroom::$types, I don't see a good solution for this problem.

from kirby-focus.

mullema avatar mullema commented on May 29, 2024 1

I posted a possible solution in the ideas repo. please upvote! getkirby/ideas#278

from kirby-focus.

flokosiol avatar flokosiol commented on May 29, 2024

Thanks for your suggestion.

I thought it must be in global scope to replace the default Darkroom class. I will test it and fix it, if I find a better way …

from kirby-focus.

flokosiol avatar flokosiol commented on May 29, 2024

Thanks for your help … very much appreciated!

from kirby-focus.

flokosiol avatar flokosiol commented on May 29, 2024

I tried to implement your suggestion. Unfortunately, it doesn't work to set the Darkroom type definition inside the custom focusCrop file method.

However, it does work when I declare a custom thumb component as you do like this …

kirbyfocus-custom-thumb

But as far as I can see, this will lead to conflicts with other custom thumb components because only one will finally be used by Kirby, right?

from kirby-focus.

mullema avatar mullema commented on May 29, 2024

I just understood why...
focusCrop is called on a Kirby instance, then file::version and the job file is generated (the thumbs component is never called here).
To actually generate the thumb, it is a new request to the server (the image url), a new Kirby instance, which does never go via focusCrop but directly to the thumbs component.

from kirby-focus.

flokosiol avatar flokosiol commented on May 29, 2024

Ok, I got it. Thanks for taking the time and for this explanation.

from kirby-focus.

Related Issues (20)

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.