This seems to work.... return sendMessage(`<img src="{{=URL('static','images/testimage.jpg')}}" max-height="200px"/><br>{{=XML(test_text,sanitize=True)}}`)
On Sat, Oct 19, 2019 at 12:23 PM Maurice Waka <mauricew...@gmail.com> wrote: > Hello > I'm trying to pass an image to view from db or static files using js. > I' trying to create an iteration that can pass a text or image or video to > the view, so far being able to pass only text to view. > The code below : > <script> > $(function() { > var getMessageText, message_side, sendMessage; > message_side = 'left'; > getMessageText = function() { > var $message_input; > $message_input = $('.message_input'); > return $message_input.val() > }; > sendMessage = function(text) { > var $messages, message; > if (text.trim() === '') { > return > } > $('.message_input').val(''); > $messages = $('.messages'); > message_side = message_side === 'left' ? 'right' : > 'left'; > message = new Message({ > text: text, > message_side: message_side > }); > message.draw(); > return $messages.animate({ > scrollTop: $messages.prop('scrollHeight') > }, 300) > }; > $('.send_message').click(function(e) { > return sendMessage(getMessageText()) > }); > $('.message_input').keyup(function(e) { > if (e.which === 13) { > return sendMessage(getMessageText()) > } > }); > sendMessage(`{{=XML(name3,sanitize=True)}}`); > setTimeout(function() { > return sendMessage(`url: > "{{=URL('static','images/testimage.jpg')}}"<br>{{=XML(test_text,sanitize= > True)}}`) > }, 2000) > }) > }.call(this)); > </script> > > > With this code instead of getting the image file, it returns a path to the > file. > What I need is the image or video instead. > How can I solve this? > Regards > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/a0m-Fmz1VWg/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/a4baa446-1fe4-4732-b641-965a17c111b3%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/a4baa446-1fe4-4732-b641-965a17c111b3%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CALkNK56kAQUho2U1gM3BYJKipQatei_sRekaExqLZzMhTh_rSw%40mail.gmail.com.