通过ID Silverstripe检索文件

时间:2018-11-09 20:55:31

标签: php image file silverstripe silverstripe-4

我当前正在使用SilverStripe 4.1,并且尝试从数据库中检索图像,并且该图像始终返回null

当我进入数据库时​​,在File表中看到文件引用。这是我尝试检索的文件的File表内容:

ID          | 2583
ClassName   | SilverStripe\Assets\Image
LastEdited  | 2018-11-08 21:05:48
Created     | 2018-11-08 21:05:48
Name        | logo-v5.png
Title       | logo-v5
ShowInSearch| 1
CanViewType | Inherit
CanEditType | Inherit
Version     | 1
ParentID    | 1753
OwnerID     | 10
FileHash    | 9e6faa29b752294d2e623bd83b17660df123af62
FileFilename| images/logo-v5.png
FileVariant | NULL

这是我尝试的方式:

File::get()->byID(2583); 
Image::get()->byID(2583);  
File::get_by_id('SilverStripe\Assets\Image', 2583);

在所有情况下都返回null。你知道我在这里想念吗?

0 个答案:

没有答案