Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions /

Cast a File object to Image


Reply


598 Views

Avatar
martinBE

Community Member, 2 Posts

18 October 2011 at 9:25pm

Edited: 19/10/2011 9:28pm

Hi
how can I cast a File object to Image object? Either in the controller or in the view. I did not find a constructor or something similar in the Image class. I need the resizing methods from the Image class.

Thanks in advance
Martin

EDIT:
Maybe I expressed the problem unclear. I have an Image gallery where I only save the folder name and display all included image files. I now solved this by querying directly for images:

$images = DataObject::get("Image", "Filename LIKE '%$escaped_folder%'", "NAME");

But I would be interested if it is poosible to cast a Object<ViewableData<DataObject<File into Object<ViewableData<DataObject<File<Image