Comments (7)
I did try that and from memory the problem was that I couldn't find a way to access the focus point coordinates from GDBackend without also modifying Image. But if you have time to experiment for yourself I would love to find a solution to this!
from silverstripe-focuspoint.
How about creating a class like FocusPointImage extends Image to overwrite CroppedImage(), then use the injector to load the new class instead of the old. Would that work?
from silverstripe-focuspoint.
It might work but I'm reluctant to subclass image as I think this could lead to incompatibility with other modules and custom code. If I force the framework to use a different class instead of Image does that mean other extensions applied to Image would be ignored? Maybe not, but if another module subclassed Image too I think you couldn't use it alongside FocusPoint?
I might be overthinking this or misunderstand how the injector works - please correct me if so :)
from silverstripe-focuspoint.
I think any module that wants to change or enhance a core class behaviour runs the risk of conflicting with other modules, no way to totally avoid that I suppose. Thinking things through is always a good thing, I personally wouldn't call that overthinking :)
If someone were to subclass Image and use that subclass in their code, it wouldn't be using your functionality. If someone uses Image, it would. I think :) Extensions to Image would still be extensions to Image, but your subclass should have access to its functionality....
But hey, it's just one more suggestion to check out, if you really want to override CroppedImage(). I'm quite happy with the way it is now actually :)
Thanks for a really nice pair of modules!
Martine
from silverstripe-focuspoint.
Thanks Martine, I'll try out your suggestion. I'm thinking it should be easy to make this optional actually - I could offer a 'no-conflict' setting that leaves things how they are and requires $CroppedFocusedImage to be used in templates, but by default I could use the injector so that $CroppedImage can be replaced. I'll let you know how it goes!
from silverstripe-focuspoint.
Okay guys this should work on the latest release - requires 3.3. and opt-in with some yml config. See ReadMe for details.
from silverstripe-focuspoint.
In 3.4 this might even let you get focused thumbnails in the CMS. Wouldn't that be a treat? silverstripe/silverstripe-framework#5043
from silverstripe-focuspoint.
Related Issues (20)
- Picker position (preview) not updated after save & publishing image (refresh needed) HOT 4
- Y axis inverted between SSv3 and v4 version of module (between module v2 and v3/4) HOT 3
- Compatibility with Silverstripe 4.10.0 HOT 2
- no popup - window appearing
- Why release version 5? HOT 1
- Unpublished Image FocusPoint value is NULL HOT 1
- attach to file instead of image? HOT 1
- Call to a member function getX() on null HOT 2
- FocusFill doesn't check wether owner exists HOT 6
- Compatible with Silverstripe 4.4.1 - latest stable release? HOT 6
- Unnecessary filesystem reads for images HOT 13
- Internal server error in asset-admin if file is missing HOT 3
- SS4. Y Axis is wrong in UI element HOT 1
- "Uncaught Error: Call to a member function getX() on null" HOT 1
- FocusPoint is not adjusted after cropping
- Call to a member function getX() on null HOT 3
- Test should run when pull requests are opened HOT 1
- V2 to V3 migrations script fails during first dev/build after SS4 upgrade (adding versioned to files) HOT 5
- FocusCropHeight appears to be broken after upgrade to 4.0 HOT 3
- Make disabled state of picker more obvious HOT 2
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 silverstripe-focuspoint.