Subject Re: [firebird-php] *NO BUG* with: ibase_blob_get
Author Gerhard Knapp
Hi Daniela,

sorry, it takes a little time, but i had some problems:)
i had an older PHP Version and this installed with phpdev5 ..
so i had to make a new install with PHP 4.3.3.RC1, and Apache 2.0.46(win32)
and there i got the problem, that i couldn't get my
post-methode-variables from one page to the other ...
till now i used:
..........................................................
<form name="login" method="POST" action="s12321.php"
<p><font face="Tahoma" size="1"><b>User: <img border="0"
src="images/ha_sp.jpg" width="107" height="16">  
Passwort: <img border="0" src="images/ha_sp.jpg" width="173"
height="16"><br>
</b></font>
<input type="text" name="uxx" size="20">
<input type="password" name="pxx" size="20">
<input type="IMAGE" name="B1" src="images/b_login.jpg"
align="absmiddle" width="82" height="22">
</form>
...........................................................
and referenced in the s12321.php this variables with:
............................................................
$uxx
$pxx
............................................................
till i checked to use now:
............................................................
$uxx = $_POST('uxx');
$pxx = $_POST('pxx');
............................................................
uff, okay, then i could try your new php_interbase.dll

test:
- loaded OK
- running OK
- BUG: not OK, the same big size of resulting files
jpgfile original = 40960 bytes -> then stored as blob in firebird 1.5 beta
3
(GRUND_FOTO BLOB SUB_TYPE 0 SEGMENT SIZE 4096), then get back in PHP with
php_interbase.dll
-> blobsize now = 786486 -> then stored as file: filesize = 786486 bytes

mhm, sorry Daniela, but i think now, there is NO BUG in php_interbase.dll,
at the beginning i didn't understand the parameters, $BINFO[0] = size of
Blob and the
resulting filesize has also the same size:

$BINFO[0]=786486
$BINFO[1]=13
$BINFO[2]=65535

My error is in storing the jpg-file in the DB, it will be stored as BMP, and
so the big size results!!!
THE ERROR WAS IN MY STORING PRODECURE NOT in "php_interbase.dll"

EXCUSE ME

source:
.............................................................
$S = "SELECT GRUND_FOTO FROM GSE WHERE GID = $gid";
$Q = ibase_query($S);
$R = ibase_fetch_object($Q);
$BINFO = ibase_blob_info($R->GRUND_FOTO);
$b1 = $BINFO[0];
$b2 = $BINFO[1];
$b3 = $BINFO[2];
if ($BINFO[2] == 0)
{
echo "<tr>
<td width='699' height='1' colspan='3'>
<br>$ausgabe
<CENTER><IMG SRC='platzhalter.gif'></CENTER>
<hr>
</td>
</tr>";
}
else
{
$TEMPFILE = tempnam("./","TMP");
$TEMPFILE .= ".jpg";
$FILEID = fopen($TEMPFILE,"wb");
$BLOBID = ibase_blob_open($R->GRUND_FOTO);

//$PIC = ibase_blob_get($BLOBID,$BINFO[2]);
//print stream_copy_to_stream($PIC, $FILEID);


while ($PIC = ibase_blob_get($BLOBID, 4096))
{
fputs($FILEID,$PIC);
}
fclose($FILEID);
ibase_blob_close($BLOBID);
echo "<tr>
<td width='699' height='1' colspan='3'>
<br>$ausgabe<br>$b1<br>$b2<br>$b3<br>
<CENTER><IMG SRC=$TEMPFILE ></CENTER>
<hr>
</td>
</tr>";
}
ibase_free_result($Q);
...............................................................

thank you very much for helping Daniela, your detailed description
of the parameters at least helped me, do understand what happened.
you can close this BUG ...

best regards
-Gerhard






-----Ursprüngliche Nachricht-----
Von: Daniela Mariaschi [mailto:nyx@...]
Gesendet: Dienstag, 01. Juli 2003 10:55
An: Gerhard Knapp
Betreff: Re: [firebird-php] BUG: ibase_blob_get


Hi Gerhard

here is the interbase.dll build against php-4.3.3RC1.
- stop apache
- cd [your-php-distro]/extensions
- rename your actual interbase.dll in interbase.orig.dll
- put this new interbase.dll I sent you
- restart apache

Could you test it please?
Cuold you send me a little script that show the error
and if it's resolved? I have no much free time so if you can
help me with it it would be nice ;)

Regards Daniela