I am trying to get images stored on SQL server (the actual imagedata are stored in the database), however some images do not have parts of them; for example, the lower half of some images is missing, and some of them are displayed correctly.
The im code used is used below:
<?php
$serverName = "TESTSERV\SQLEXPRESS";
$database = "test";
$user = "user";
$password="password";
$DSN_general="odbc-test";
$conn_general=odbc_connect($DSN_general, $user, $password);
$sql = "SELECT * FROM InetDb.dbo.IndivImages WHERE IndivNdx = 6 AND TenantNdx = 41";
$sql_run = odbc_exec($conn_general,$sql);
$row = odbc_fetch_array($sql_run);
header('Content-Type: image/jpeg');
echo $row['UserImage'];
?>
the InetDb.dbo.IndivImages table contains the following fields:
- TanantNdx: type tinyint
- IndivNdx: type smallint
- UserImage: Image Type
This may be a stupid question, but I could not find much help with this. Any idea on why I came across this issue?
source
share