0

我有一个模型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 与 4.2.1 的分步示例

如何在敏捷工具包 4.2 中使用文件上传

如何在 Agiletoolkit 的 API 中使用 Filestore?

4

1 回答 1

0

I figured out, its like this:

$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'));
于 2013-11-23T02:51:41.070 回答