【问题标题】:How to display image from filestore/Field_Image in agiletoolkit?如何在敏捷工具包中显示来自文件存储/Field_Image 的图像?
【发布时间】:2013-12-08 02:11:08
【问题描述】:

我有一个模特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

How to use file upload in agile toolkit 4.2

How to use Filestore in API in Agiletoolkit?

【问题讨论】:

    标签: php models atk4 agiletoolkit


    【解决方案1】:

    我想通了,是这样的:

    $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'));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-05-16
      • 1970-01-01
      • 1970-01-01
      • 2020-10-18
      • 1970-01-01
      • 2019-05-24
      • 2021-06-11
      相关资源
      最近更新 更多