Providing image to <a href="??"></a> from database

Forum to discuss the Web client version of Servoy.

Providing image to <a href="??"></a> from database

Postby sovanm » Thu Nov 17, 2011 7:19 am

Hi,
I was trying to create a 'href' to an image from my database using servoy_blobloader,

Code: Select all
'<a href="media:///servoy_blobloader?servername=<myserver>&tablename=fancyboximages&dataprovider=images&rowid=1"><img src="media:///servoy_blobloader?servername=<myserver>&tablename=fancyboximages&dataprovider=images&rowid=1"/></a>'


which is showing the byte array as the output while in 'src' it is working fine.And if i pass a media directly into the 'href', like

Code: Select all
<a href="media:///xyz.jpg"><img src="media:///servoy_blobloader?servername=<myserver>&tablename=fancyboximages&dataprovider=images&rowid=1"/></a>

it is also working.

Instead , i have tried fetching the image from database and storing it in a temporary file then passing the file path in the 'href' but the output is 'cannot show the image'(jquery error message).


Please suggest me a way to pass a image media from database as a reference.

I am new in servoy so please attach code snippet so that i can get a better idea..... :)

Thanks in advance
Sovan
sovanm
 
Posts: 99
Joined: Fri Oct 28, 2011 1:55 pm
Location: Bhubaneswar, India

Re: Providing image to <a href="??"></a> from database

Postby david » Thu Nov 17, 2011 4:41 pm

The blob loader returns a byte array of the image so it doesn't make sense to put that in the href property which expects a string representing the path to a file on the web server.

Temp files cannot be accessed by web servers generally as they are typically stored in a hidden directory of the operating system in question. You need to explicitly save the file to a location in Servoy's tomcat directory to be available to web clients as a valid href link.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1725
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Providing image to <a href="??"></a> from database

Postby sovanm » Fri Nov 18, 2011 12:11 pm

Hi david,

Thanks a lot. it worked...... :)
sovanm
 
Posts: 99
Joined: Fri Oct 28, 2011 1:55 pm
Location: Bhubaneswar, India


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 2 guests