Is it possible to insert pictures from database in HTML?

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Postby Jan Blok » Mon Aug 30, 2004 10:47 am

This works ok for me:
Code: Select all
elements.blob_url_display.setImageURL('media:///servoy_blobloader?servername='+controller.getServerName()+'&tablename='+controller.getTableName()+'&dataprovider=img&mimetype=image/gif&rowid1=1');

the same url syntax can be used in html.
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby patrick » Mon Aug 30, 2004 11:18 am

A method, that sets a label, works for me, too:

Code: Select all
var image = 'media:///servoy_blobloader?servername=' + currentcontroller.getServerName() + '&tablename=v_laender&dataprovider=flagge_klein&mimetype=image/gif&rowid1=' + uid_v_laender
elements.bild.setImageURL(image);


What doesn't work, is to use this in a calculation where either the image is returned (in a media calculation) or returned nested in HTML.

For the calculation I am using the exact same code as above, but I return "image" in case of the media calculation.
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby Jan Blok » Mon Aug 30, 2004 1:55 pm

Loading in html seems no problem for me:
Code: Select all
elements.blob_url_display.text =  '<html><img src="media:///servoy_blobloader?servername='+controller.getServerName()+
'&tablename='+controller.getTableName()+
'&dataprovider=img&mimetype=image/gif&rowid1=1"></html>';


What you are trying todo with the media field I don't understand you are loading the url text in a media field? (which only support byte array's).
It seems to me you are trying to use the media field in the wrong way
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby patrick » Mon Aug 30, 2004 2:15 pm

We are having communication troubles...

Let's try it this way:

What I want to do is a value list which shows icon and text in the popup. I have done those before with html by hand. Each entry is a table with one row and three columns: icon, spacer, text.

Now I want to use the new functionality to do a value list like that based on a table. I have a table with countries and their flags. So I thought I create a calculation (stored) in that table that throws me the html code for one entry and I could then build a value list on that column.

How do I have to go about this?
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby Jan Blok » Mon Aug 30, 2004 4:06 pm

1) make a dbvaluelist on columns (language_id,stored_calc_flag_language)
2) let stored_calc_flag_name return:
Code: Select all
'<html><img src="media:///servoy_blobloader?...flagimage-per-language_id..."> - '+language_name+'</html>'
3) attach value list to combobox
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby patrick » Mon Aug 30, 2004 6:06 pm

Hello Jan,

thanks for your patience! I have found my problem, it was something little but itchy in my HTML code. Now it works!
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Previous

Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 30 guests

cron