[PHP] PHP and Images stored in mysql

2002-01-09 Thread Rodrigo Peres

Hi list,

I have some images stored in a blob in mysql. I've made this code to output
them to html, but the problem is if there's no image at a given id the page
tooks a long time to load and display the "broken image", there's a way to
avoid this, I mean, there's a way to print a message or another image if
there's none in mysql ???

executa($sql);
$resultado = $query->dados();
mysql_close();

$imagem_banco = $resultado['Imagem_data'];
$type = $resultado['Imagem_type'];
if($imagem_banco != "") {
HEADER("Content-type: $type");
echo($imagem_banco);
}
}
?>

Thank's in advance

Rodrigo
-- 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP and Images stored in mysql

2002-01-10 Thread Rodrigo Peres

How can I echo an image from other location than the mysql using this kind
of script?? since I'm using php to output the image from database, there's a
way to change it to a ftp link for example if image doesn't exists??

this is my script:

executa($sql);
$resultado = $query->dados();
mysql_close();

$imagem_banco = $resultado['Imagem_data'];
$type = $resultado['Imagem_type'];
if($imagem_banco != "") {
HEADER("Content-type: $type");
echo($imagem_banco);
}
}
?>

and I call it from my page with .

Thank's

Rodrigo


on 1/9/02 9:16 PM, Bogdan Stancescu at [EMAIL PROTECTED] wrote:

> My way around this is using two fallback stages: for one you test
> mysql_num_rows() after performing the query. If that's 0, use a default image
> placed in the database beforehand. If that also returns a null
> mysql_num_rows()
> then echo an image (probably the same default) from a known location in the
> filesystem.
> 
> HTH
> 
> Bogdan
> 
> Rodrigo Peres wrote:
> 
>> Hi list,
>> 
>> I have some images stored in a blob in mysql. I've made this code to output
>> them to html, but the problem is if there's no image at a given id the page
>> tooks a long time to load and display the "broken image", there's a way to
>> avoid this, I mean, there's a way to print a message or another image if
>> there's none in mysql ???
> 

-- 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP and Images stored in mysql

2002-01-09 Thread Bogdan Stancescu

My way around this is using two fallback stages: for one you test
mysql_num_rows() after performing the query. If that's 0, use a default image
placed in the database beforehand. If that also returns a null mysql_num_rows()
then echo an image (probably the same default) from a known location in the
filesystem.

HTH

Bogdan

Rodrigo Peres wrote:

> Hi list,
>
> I have some images stored in a blob in mysql. I've made this code to output
> them to html, but the problem is if there's no image at a given id the page
> tooks a long time to load and display the "broken image", there's a way to
> avoid this, I mean, there's a way to print a message or another image if
> there's none in mysql ???


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]