Hi Guy's

Can anyone tell me what I'm doing wrong. I'm trying to get a blob out of the SQL DB and Display the image. It will only give me 4096 max. I've tried many, many different things and nothing will extract the whole thing. I thought it was a limitation on ADO and found the mssql_connection has the same problem. I've also downloaded the newest service pack for SQL 7.0(someone told me it was a limitation with SQL 7.0 and the SP4 fixed the problem) didn't work. I know the whole image is there because I wrote a VB Program which writes the image to a file and then I can see it.

If anyone can tell me what I'm doing wrong I would appreciate. Here is the last bit of code I tried. I'm only getting a portion of the image. I'm using ADO connection and recordsets but I have the same results when I us mssql_connect.

<?
header("Content-type: image/jpg");
include_once("config.inc");
include_once("conn.inc");
$cn->readonly = true;
//$cn->binmode = ODBC_BINMODE_PASSTHRU;
$cn->maxblobsize = 0; //zero to pass through
$sku="coke";
//$sku = $HTTP_GET_VARS['sku_cd'];
$sku="'".$sku."'";
$cmd5="SELECT img_image FROM mylximage WHERE img_key = $sku AND img_type = 'sku'";
$rs5 = $cn->Execute($cmd5);
if (!$rs5){error_dis(21,"die","getimage.php");}
While (!$rs5->EOF){
$sku_image=$rs5->fields("img_image");
//$sku_image->max_length = '8192';
//$sku_image = $rs5->MetaType($sku_image->type,$sku_image->max_length,$sku_image);
//$sku_image=rawurldecode($sku_image);

$rs5->MoveNext();
}

print($sku_image);
// release resources
// clean up release resources...
flush();
$cmd5='';
$rs5->close();
$cn->close();
?>

Shelley

    3 months later

    I have the exact same problem!!!

    An ASP script running on the same server pulls blobs from the same db several 100kb's, no problem! This script connects using ADODB over ODBC.

    My PHP(4.2.3) script truncate's the same picture's to 4kb!

    Can't find anything on this in the manual... So... ANYONE???????

    If I get no reaction (the post before me waits for a long time)

    should I REPORT this as a BUG?

      Found the solution.

      Problem lies in the default TEXTSIZE property. phpinfo() tells you that serversettings are used. NOT!

      First, set it right on your sqlserver: Open the Management Console with your SQLServer .
      Goto "query Analyzer" under "tools". Select your db. Type
      SELECT @@TEXTSIZE
      run this line, it will tell the current setting.
      adjust the setting with:
      SET TEXTSIZE 131072
      (for 128 kb or any limit you like)

      Now open your php.ini. Adjust the settings under the mssql-block:
      mssql.textlimit = 2147483647
      (2 Gb max size for a single blob field)

      mssql.textsize = 131072
      (this is the max retrieve size)

      Make these lines active by removing the ";". I did this also with blocksize, to be sure.

      Now restart php. phpinfo() now shows your settings.

      Ready!

        Write a Reply...