phpbar.de logo

Mailinglisten-Archive

AW: [php] Image via Abruf...

AW: [php] Image via Abruf...

Michael Raab php_(at)_phpcenter.de
Mon, 18 Jun 2001 17:42:15 +0200


Hallo,

at Monday 18.06.2001 (17:28 +0200), Mailanbecker wrote:
> > Ich mache es mit <img src=3D"pic.php?id=3D0001" border=3D0>
>
>lol, du bist mir ja lustig... :o)

War ich schon immer. ;-)))

>wie sieht das script dazu aus? Mach ich dazu einfach
>
>         echo "banner.gif";

Nicht ganz.

>Oder wie machst du das???

So
---------
MYSQL_CONNECT($hostname,$dbUser,$dbPass) OR DIE("Error: Cannot connect to=20
Database");
_(at)_mysql_select_db( "$dbName") or die( "Error: Cannot connect to Database");

$query =3D "SELECT * from pictures WHERE id=3D'$ID'";
$result =3D MYSQL_QUERY($query);
$number =3D MYSQL_NUMROWS($result);


$myrow =3D mysql_fetch_array($result);

if ($number<>0) {
                  $file =3D=20
"/homepages/8/d26976363/htdocs/images/".$myrow["name"];
                  if (file_exists($file)) {
                                            $size =3D GetImageSize ($file);
                                            if ($size[2]=3D=3D"3") {
                                                header("Content-type:=20
image/png");
                                                              }
                                            elseif ($size[2]=3D=3D"2"){
                                                header("Content-type:=20
image/jpeg");
                                                              }
                                            elseif ($size[2]=3D=3D"1") {
                                                header("Content-type:=20
image/gif");
                                                              }

                                            header ("Pragma: no-cache");
                                            header ("Expires: 0");
                                            _(at)_readfile($file);
                                            $result =3D mysql_query("UPDATE=
=20
pictures SET count=3Dcount+1 WHERE id=3D'$ID'");
                                          }
                                    else { echo "file not found"; }
}
mysql_close();
?>---------


Gru=DF
Michael

--=20
Phone   +49 5723 98077 - 0
Fax     +49 5723 98077 - 1
Mobil   +49 173 4315914
Home    http://www.macbyte-computing.de/
PGP-Key http://www.macbyte-computing.de/shared/mykey.pkr



php::bar PHP Wiki   -   Listenarchive