note 30315 added to function.fopen
| From: | chuty_hernan at hotmail dot com | Date: | Thu, 13 Mar 2003 21:10:21 +0000 |
| Subject: | note 30315 added to function.fopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45230@lists.php.net to get a copy of this message | ||
Hola to all, I have the following code that opens an imagen.png and the guard(keeper) in a bariable
in binary format. To seeing if me esplico better. What attempt is to read an imagen.png and to guard
the information in a variable in binary format. It(He,She) is because of it that I guard the
variable in binary format and to see if to well-read good I guard her(it) in another archivo.png
But, when the information guards if I compare the image of origin with the image of destiny in
binary format me He(She) guards garbage in the first one initially(originally) and at the end of the
image of destiny. I am doing this test(proof) to see which is a motive that on having guarded the
image in binary format in my base of information guarding garbage garbage. Thanks to all I expect
they can help me, It(He,She) costs(is worth) a sorrow(sentence) to clarify that I use PHP with MS
SQL Server 2000. Regards.
<?php
$Ifi ='C:\\hernan\\image\\Frm-1473.png';
$Ifo ='C:\\hernan\\image\\Frm-1472.png';
if (file_exists($Ifi )) {
echo " File [$Ifi]";
echo '<br>';
$lenIfi = filesize ($Ifi);
if( $lenIfi > 0 ) {
echo "la longitud es $lenIfi bytes.";
echo '<br>';
$fhIfi = fopen($Ifi, 'rb') or die("El archivo [$Ifi] no pudo ser abierto o
creado.");
echo " fopen ok! [$fhIfi] ";
echo '<br>';
$bufIfi = fread( $fhIfi, $lenIfi );
fclose( $fhIfi );
$fhIfo = fopen($Ifo, 'wb+',1 ) or die("El archivo [$Ifo] no pudo ser abierto o
creado.");
echo " fopen ok! [$fhIfo] ";
echo '<br>';
if( $fhIfo ) {
$lenIfo = fwrite( $fhIfo, $bufIfi, $lenIfi );
fclose( $fhIfo );
}
}
else {
echo " -> Error: la longitud es $lenIfi bytes.";
echo '<br>';
}
}
else {
echo ' -> Error: el archivo no existe.';
}
?>
Hola a todos, tengo el siguiente codigo que abre una imagen.png y la guarda en una bariable en
formato binario.
A ver si me esplico mejor.
Lo que intento es leer una imagen.png y guardar la informacion en una variable en formato binario.
Es por eso que guardo la variable en formato binario y para ver si se a leido bien la guardo en otro
archivo.png
pero, al guardar la informacion si comparo la imagen de origen con la imagen de destino en formato
binario me
guarda basura en la primera al principio y al final de la imagen de destino.
Esta prueba la estoy haciendo para ver cual es motivo que al guardar la imagen en formato binario en
mi base de datos me esta guardando basura.
Gracias a todos espero me puedan ayudar,
Vale la pena aclarar que utilizo PHP con MS SQL Server 2000.
Saludos.
--
http://www.php.net/manual/en/function.fopen.php
http://master.php.net/manage/user-notes.php?action=edit+30315
http://master.php.net/manage/user-notes.php?action=delete+30315
http://master.php.net/manage/user-notes.php?action=reject+30315