Jump to:

3432 Posts in 1058 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Cast a File object to Image

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 532 Views
  • martinBE
    Avatar
    Community Member
    2 Posts

    Cast a File object to Image Link to this post

    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

    532 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.