2013-11-23 22 views
0

我有一個模型Profile如何在agiletoolkit中顯示來自filestore/Field_Image的圖像?

<?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中的圖像標識。

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

How to use file upload in agile toolkit 4.2

How to use Filestore in API in Agiletoolkit?

回答

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')); 
相關問題