cancel
Showing results for 
Search instead for 
Did you mean: 

img Tag within HTML hosted in DB

Baron
Participant
0 Kudos
1,239

I am hosting a HTML file in Sybase 10 and it works so far good.

I want now to add img Tag in my HTML but it doesnt work, because img Tag expects a relative path to the img as "src".

Now the question is, what is the current folder for my webservice? I tried the path of dbsrv10.exe but without success "C:\\Program Files (x86)\\SQL Anywhere 10\\win32"

The script in DB looks something like:

create PROCEDURE hello_world( )

RESULT (html_doc long varchar)

BEGIN

CALL dbo.sa_set_http_header( 'Content-Type', 'text/html' );

select '<!DOCTYPE html>\\n'

|| '<html lang="en">\\n'

|| '<body>\\n'

|| 'hello world
\\n'

|| '<imgg srcc="010.jpg">\\n'

|| '</body>\\n'

|| '</html>\\n';

END;

create SERVICE hello_world TYPE 'RAW'

AUTHORIZATION OFF

USER DBA

AS CALL hello_world;

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi Sarkis,

maybe this sample helps: https://www.db-tecknowledgy.info/fileshare/public/SQLAnyIcon.SQL
I provide the Image binary as a service. In case you want images from multiple or large server side files, you can utilize xp_read_file rather than specifying the binary content literally.
The logic around provides a framework and sample for a root service listing the available "open" services in the DB, with the SQL Anywhere product icon as favicon. I just verified that it runs against v.17, but I'm quite sure that I used it with older versions in the past.

HTH
Volker

Baron
Participant
0 Kudos

Thank you all. I found a good solution using IIS, so I added a virtual directory in IIS and then used the full URL in my HTML to access each photo from this virtual directory.

Something like: <imgg srcc="http://my_ip/my_directory/111.jpg">

I write imgg instead of img and srcc instead of src in order to avoid HTML interpreting on this page.