我有一个模型Profile
<?php
class Model_Profile extends Model_Table {
public $table = 'profile';
function init(){
parent::init();
...
$m = $this->add('filestore/Field_Image');
}
}
现在在我的index.php
中,我正在尝试在模板中设置完整的图像路径。
$m = $this->add('Model_Profile')->loadBy('user_id',$this->api->auth->get('id'));
//Here i want to var_dump the full image path example (/admin/upload/0/20131123014011__photo-on-23-11-2013-at-01.36.jpg)
这将显示表filestore_file中的图像ID。
die('Filestore image:' . $m->get('filestore_field_image'));
与此主题相关的讨论: https://groups.google.com/forum/#!topic/agile-toolkit-devel/i-i9OK4Ya1A
我试过这个
$fm = $this->add('filestore/Field_Image')->load($m->get('filestore_field_image'));
var_dump($fm->getThumbURLExpr());
但它引发了异常
其他链接:
FileStore step by step example with 4.2.1
答案 0 :(得分:0)
我想通了,就像这样:
$m = $this->add('Model_Profile')->loadBy('user_id',$this->api->auth->get('id'));
$mf = $this->add('filestore/Model_File');
$mf->load($m->get('filestore_field_image'));
var_dump($mf->get('url'));