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. ...
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.

 
  1. <?php
  2. /**
  3. * MovimentoForm Registration
  4. * @author <your name here>
  5. */
  6. class MovimentoForm extends TPage
  7. {
  8. protected $form; // form
  9. use Adianti\Base\AdiantiStandardFormTrait; // Standard form methods
  10. /**
  11. * Class constructor
  12. * Creates the page and the registration form
  13. */
  14. function __construct()
  15. {
  16. parent::__construct();
  17. $this->setDatabase('conexao2'); // defines the database
  18. $this->setActiveRecord('Movimento'); // defines the active record
  19. // creates the form
  20. $this->form = new BootstrapFormBuilder('form_Movimento');
  21. $this->form->setFormTitle('Movimento');
  22. // create the form fields
  23. $idy = new TEntry('idy');
  24. $seridy = new TDBCombo('seridy', 'conexao2', 'Servico', 'idy', 'des');
  25. $undidy = new TDBCombo('undidy', 'conexao2', 'Unidade', 'idy', 'des');
  26. $obs = new TText('obs');
  27. $fot = new TImage('fot');
  28. $dat = new TDate('dat');
  29. $ava = new TEntry('ava');
  30. // add the fields
  31. $this->form->addFields( [ new TLabel('ID') ], [ $idy ] );
  32. $this->form->addFields( [ new TLabel('Serviço') ], [ $seridy ] );
  33. $this->form->addFields( [ new TLabel('Unidade') ], [ $undidy ] );
  34. $this->form->addFields( [ new TLabel('Observação') ], [ $obs ] );
  35. $this->form->addFields( [ new TLabel('Foto') ], [ $fot ] );
  36. $this->form->addFields( [ new TLabel('Data') ], [ $dat ] );
  37. $this->form->addFields( [ new TLabel('Avaliação') ], [ $ava ] );
  38. // set sizes
  39. $idy->setSize('100%');
  40. $seridy->setSize('100%');
  41. $undidy->setSize('100%');
  42. $obs->setSize('100%');
  43. //$fot->setSize('100%');
  44. $dat->setSize('100%');
  45. $ava->setSize('100%');
  46. if (!empty($idy))
  47. {
  48. $idy->setEditable(FALSE);
  49. }
  50. /** samples
  51. $fieldX->addValidation( 'Field X', new TRequiredValidator ); // add validation
  52. $fieldX->setSize( '100%' ); // set size
  53. **/
  54. // create the form actions
  55. $btn = $this->form->addAction(_t('Save'), new TAction([$this, 'onSave']), 'fa:floppy-o');
  56. $btn->class = 'btn btn-sm btn-primary';
  57. $this->form->addAction(_t('New'), new TAction([$this, 'onEdit']), 'fa:eraser red');
  58. // vertical box container
  59. $container = new TVBox;
  60. $container->style = 'width: 90%';
  61. // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  62. $container->add($this->form);
  63. parent::add($container);
  64. }
  65. }
  66. ?>

Curso Dominando o Adianti Framework

O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado!


Dominando o Adianti Framework Quero me inscrever agora!

Comentários (4)


NR

A TImage não faz a conversão automática. Crie um TElement e faça o tratamento dos dados do campo.
ML

Que tratamentos deve ser feito no TElement ?

Ficaria algo do tipo ?
$fot = new TElement('fot'); $fot->style = "width:100px;height:100px"; $this->form->addFields( [ new TLabel('Foto') ], [ $fot ] );


Ainda não consegui visualizar a imagem

TB

Conseguiu resolver?
ML

Consegui resolver meu problema, passei a usar o TFile mesmo