Article
Problem
A Forum reader recently asked:
"We have a Security System with a SQL database that holds our employee pictures as BLOB objects. Is it possible to link to these from the User App?"
And here is the response from Cathy Leik ...
Solution
Thanks to the guys I work with - they wrote a PHP script to allow us to have the User App query the SQL Database directly. The script looks like this:
<?php
// Change the myServer, myUser, myPass, and myDB variables below to match
// your environment
// the "pic" variable in this case happens to be the workforceID, this is
the
// unique identifier we are using to match employees
// This script will return the image; modifications may need to be made to
the php.ini file
// on the server to handle over 4096 bytes
// In our case, we are using MS SQL, increased both the mssql.textlimit
and mssql.textsize
// params
$pic = $_GET['pic'];
$myServer = "ServerName";
$myUser = "DBUser";
$myPass = "DBUserPassword";
$myDB = "DBName";
$dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't
connect to SQL Server on $myServer");
$selectdb = mssql_select_db($myDB, $dbhandle) or die("Couldn't open
database $myDB");
// Query the database for the picture - Personnel.text1 contains the
workforceID number
// The picture is stored in the Images table, there is a relationship
between Personnel.objectID and Images.ParentID
//
$querydb = "select Image from Images INNER JOIN Personnel on
Personnel.objectID = Images.ParentID WHERE Personnel.text1 = $pic";
$result = mssql_query( $querydb );
for ($i = 0; $i < mssql_num_rows( $result ); ++$i)
{
$line = mssql_fetch_row($result);
print( "$line[0]");
}
mssql_close($dbhandle);
?>
In UserApp, modify the portlet HTML layouts to use the following:
$[[IMG:"http://yourservernameorip/portalimageget.php?empid="+workforceID+]]
Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).
It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.
Related Articles
User Comments
- Be the first to comment! To leave a comment you need to Login or Register
- 3156 reads


0