phpbar.de logo

Mailinglisten-Archive

AW: AW: [php] Image via Abruf...

AW: AW: [php] Image via Abruf...

Mailanbecker php_(at)_phpcenter.de
Mon, 18 Jun 2001 19:19:56 +0200


> -----Ursprüngliche Nachricht-----
> von Michael Raab
> MYSQL_CONNECT($hostname,$dbUser,$dbPass) OR DIE("Error: Cannot connect to
> Database");
> _(at)_mysql_select_db( "$dbName") or die( "Error: Cannot connect to Database");
>
> $query = "SELECT * from pictures WHERE id='$ID'";
> $result = MYSQL_QUERY($query);
> $number = MYSQL_NUMROWS($result);
>
>
> $myrow = mysql_fetch_array($result);
>
> if ($number<>0) {
>                   $file =
> "/homepages/8/d26976363/htdocs/images/".$myrow["name"];
>                   if (file_exists($file)) {
>                                             $size = GetImageSize ($file);
>                                             if ($size[2]=="3") {
>                                                 header("Content-type:
> image/png");
>                                                               }
>                                             elseif ($size[2]=="2"){
>                                                 header("Content-type:
> image/jpeg");
>                                                               }
>                                             elseif ($size[2]=="1") {
>                                                 header("Content-type:
> image/gif");
>                                                               }
>
>                                             header ("Pragma: no-cache");
>                                             header ("Expires: 0");
>                                             _(at)_readfile($file);
>                                             $result = mysql_query("UPDATE
> pictures SET count=count+1 WHERE id='$ID'");
>                                           }
>                                     else { echo "file not found"; }
> }
> mysql_close();
> ?>---------

jo...brauchte nur readfile();
Damit hat es gefunzt ;o)

Mfg



php::bar PHP Wiki   -   Listenarchive