webForumDet fria alternativet

Image Viewer

0 svar · 1 320 visningar · startad av nanne

nanneMedlem sedan dec. 19991 749 inlägg
#1

Image viewer är till för de som inte vill visa URL till sina bilder.
Scriptet är inte på något sätt komplett utan meningen är att man ska koppla till en data bas. Men det går bra att länka direkt t.ex.

<img src="showpic?pic=minbild">

<?
//This is the directory where the pictures is
//This may NOT be a URL. The file to be examined must be accessible via the server's filesystem
$dir="SÖKVÄG TILL BILDERNA HÄR";

//Determen the filetype
//If the file doesnt exist then choose a default picture
if(file_exists("$dir$pic.gif")) {
  $pic="$pic.gif";
  $type="image/gif";
}else if(file_exists("$dir$pic.jpg")) {
  $pic="$pic.jpg";
  $type="image/jpeg";
}else if(file_exists("$dir$pic.png")) {
  $pic="$pic.png";
  $type="image/png";
}else {
   $pic="ingenbil.gif";
}

//Tell the broser what we are going to show a picture
header("Content-type: $type");
//Tell the browser what picture we gonna show
header("Content-disposition: filename=$pic");
//Print the picture
readfile("$dir$pic");
?>

------------------
Vackra djur gör fula saker även dom

nanne.net

127 ms totalt · 3 externa anrop · v20260731065814-full.beb2e261
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
125 ms — hämta tråd, inlägg och bilagor (db)