[Image FT] Issue programmatically getting the cropped image
Created 7 years ago by damian_nzI am using the Image FT and I need to programmatically get the cropped path.
I know from the docs that I can do ->cropped()->path()
on the presenter
I have the FT class (can dump it out) but if I run getPresenter()
on that I get the standard FieldTypePresenter
which doesn’t have the cropped
method.
Do I need to instantiate the ImagePresenter
and manually present? Or have I missed something that is causing the FT to have the wrong presenter?
That's weird you'd get the field type presenter though.. Ill have to check that out.
I think the issue is that my field is not known to the page entry (tsk tsk but maintaining old code).
I see in the FT class there is a couple times where it gets data using the entry.
For example this is in the decorate method
$value->setData(json_decode($this->entry->{$this->getField() . '_data'}));
What class should the entry be? and can I manually set the entry?
Try first decorating the entry with the decorator or the magic attribute:
Something like that should do it.