TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Save jpg image to database
  • Hi guys, I want to save a jpeg image created in a Kohana-based application. I have defined the field as BLOB in tha database but I don't know what "data-type" to set in the ORM class for the table columns array. More precisely, as I have the following:

    'id'   => array('data_type' => 'int',    'is_nullable' => FALSE),
    'name'  => array('data_type' => 'string', 'is_nullable' => FALSE)
    

    what would be the line for:

    'image'  => array('data_type' => '?', 'is_nullable' => FALSE)
    

    ? I have tried:

    'data_type' => 'blob'
    

    but it exits on error. Thanks

  • use http://kohanaframework.org/3.3/guide-api/ORM#list_columns to see true values, but ORM not used info from columns arrays

  • Do you mean that I use the following?

    $_table_columns = $this->list_columns();

  • yes, orm already use it's: http://kohanaframework.org/3.3/guide-api/ORM#reload_columns

    // Grab column information from database
    $this->_table_columns = $this->list_columns();
    

    create empty model : class Picture extends ORM {} and call

    $pic = ORM::factory('Picture');
    var_export($pic->list_columns());
    

    copy displayed list_columns into $this->_table_columns

  • Perfect, thanks!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion