Comments (8)
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.
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.
I posted a possible solution in the ideas repo. please upvote! getkirby/ideas#278
from kirby-focus.
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.
Thanks for your help … very much appreciated!
from kirby-focus.
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 …
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.
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.
Ok, I got it. Thanks for taking the time and for this explanation.
from kirby-focus.
Related Issues (20)
- Question regarding 'components.thumb' HOT 2
- kirby3-colorist supports 'Focus' HOT 4
- Does not create cropped images on server HOT 5
- Update focus field on `file.replace` HOT 4
- Transparent PNG Problem HOT 1
- Does not play nice with `translate: false` HOT 1
- WebP Support HOT 12
- [Question] Is the support for Kirby Block previews planned HOT 1
- focusSrcset does not update URL on focus point changes HOT 11
- New Kirby 3.6 Feature to support multiple mime-types is not working with this plugin for GD. HOT 3
- WebP and AVIF generated images put into wrong folder in v3.0.8 HOT 26
- Kirby 3.5.x not supported in v3.0.8 HOT 7
- [Question] multiple focus fields HOT 2
- CSS not being loaded HOT 2
- Reset focuspoint HOT 1
- Optional color fading ? HOT 2
- Preview missing for svg HOT 2
- value without effect for foxi HOT 1
- avif files do not get cropped or resized HOT 1
- Migration to native Focus in Kirby v4 - regex to use HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kirby-focus.