Jump to:

3460 Posts in 1064 Topics by 739 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: 544 Views
  • martinBE
    Community Member
    2 Posts

    Cast a File object to Image Link to this post

    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

    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

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.