You are here: Re: retrieve image from MySQL with php error « PHP Programming Language « IT news, forums, messages
Re: retrieve image from MySQL with php error

Posted by Andy Hassall on 06/07/05 00:51

On 6 Jun 2005 13:18:19 -0700, "theonlydrayk@gmail.com" <theonlydrayk@gmail.com>
wrote:

><?php
> include('dbinfo.inc.php');
>
> mysql_connect($localhost,$username,$password);
> @mysql_select_db($database) or die( "Unable to select database");
> $query = "SELECT file,filesize,filetype FROM user WHERE id=1;";
> $result=mysql_query($query);
> mysql_close();
>
> $file=mysql_result($result,0,"file");
> $filesize=mysql_result($result,0,"filesize");
> $filetype=mysql_result($result,0,"filetype");
>
> header('Content-Type: '.$filetype);
> print $file;
>?>
>
>it's don't work, firefox gave me "The image
>http://ip:8080/viewimage.php
>cannot be displayed, because it contains error."
>IE show me nothing at all.
>
>any one have a idea ?

One trick to debugging dynamic generation of images is to add in a
header("Content-type: text/plain"), so you can see the output.

A common error is that there is blank space, or even an error or warning
message produced, which the browser then tries (and fails) to interpret as
image data. When displayed as text you can see this.

--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация