ML
TImage - base64
Como faço para poder mostrar minha imagem que está em base64 (LONGBLOB) no formulário ??
Do jeito q está não está aparecendo nada, nem mesmo erro.
Do jeito q está não está aparecendo nada, nem mesmo erro.
- <?php
- /**
- * MovimentoForm Registration
- * @author <your name here>
- */
- class MovimentoForm extends TPage
- {
- protected $form; // form
-
- use Adianti\Base\AdiantiStandardFormTrait; // Standard form methods
-
- /**
- * Class constructor
- * Creates the page and the registration form
- */
- function __construct()
- {
- parent::__construct();
-
- $this->setDatabase('conexao2'); // defines the database
- $this->setActiveRecord('Movimento'); // defines the active record
-
- // creates the form
- $this->form = new BootstrapFormBuilder('form_Movimento');
- $this->form->setFormTitle('Movimento');
-
- // create the form fields
- $idy = new TEntry('idy');
- $seridy = new TDBCombo('seridy', 'conexao2', 'Servico', 'idy', 'des');
- $undidy = new TDBCombo('undidy', 'conexao2', 'Unidade', 'idy', 'des');
- $obs = new TText('obs');
- $fot = new TImage('fot');
- $dat = new TDate('dat');
- $ava = new TEntry('ava');
- // add the fields
- $this->form->addFields( [ new TLabel('ID') ], [ $idy ] );
- $this->form->addFields( [ new TLabel('Serviço') ], [ $seridy ] );
- $this->form->addFields( [ new TLabel('Unidade') ], [ $undidy ] );
- $this->form->addFields( [ new TLabel('Observação') ], [ $obs ] );
- $this->form->addFields( [ new TLabel('Foto') ], [ $fot ] );
- $this->form->addFields( [ new TLabel('Data') ], [ $dat ] );
- $this->form->addFields( [ new TLabel('Avaliação') ], [ $ava ] );
- // set sizes
- $idy->setSize('100%');
- $seridy->setSize('100%');
- $undidy->setSize('100%');
- $obs->setSize('100%');
- //$fot->setSize('100%');
- $dat->setSize('100%');
- $ava->setSize('100%');
-
- if (!empty($idy))
- {
- $idy->setEditable(FALSE);
- }
-
- /** samples
- $fieldX->addValidation( 'Field X', new TRequiredValidator ); // add validation
- $fieldX->setSize( '100%' ); // set size
- **/
-
- // create the form actions
- $btn = $this->form->addAction(_t('Save'), new TAction([$this, 'onSave']), 'fa:floppy-o');
- $btn->class = 'btn btn-sm btn-primary';
- $this->form->addAction(_t('New'), new TAction([$this, 'onEdit']), 'fa:eraser red');
-
- // vertical box container
- $container = new TVBox;
- $container->style = 'width: 90%';
- // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
- $container->add($this->form);
-
- parent::add($container);
- }
- }
- ?>
A TImage não faz a conversão automática. Crie um TElement e faça o tratamento dos dados do campo.
Que tratamentos deve ser feito no TElement ?
Ficaria algo do tipo ?
Ainda não consegui visualizar a imagem
Conseguiu resolver?
Consegui resolver meu problema, passei a usar o TFile mesmo