Git Product home page Git Product logo

Comments (7)

jonom avatar jonom commented on June 29, 2024

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.

Martimiz avatar Martimiz commented on June 29, 2024

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.

jonom avatar jonom commented on June 29, 2024

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.

Martimiz avatar Martimiz commented on June 29, 2024

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.

jonom avatar jonom commented on June 29, 2024

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.

jonom avatar jonom commented on June 29, 2024

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.

jonom avatar jonom commented on June 29, 2024

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)

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.