Re: Loading Images

From: Date: Wed, 27 Mar 2002 07:50:38 +0000
Subject: Re: Loading Images
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-90335@lists.php.net to get a copy of this message
At 26.03.2002 14:44, you wrote:
I wasn't so much concearned about security of users grabbin pics. I am more trying to learn how these people load there menus dynamically and pics dynamically. Do you have any links to pages or code that describe how to make a link in the db to pics on my filesystem? Thanks. -Chris <snip>
I cannot help you with code,also it wouldn´t really help you understanding the problem but give you more problems understanding my code. I use to have a table with the following structure TABLE MENU
rn      // that´s an autoincrement number for indexing
page // on which page the component will appear "foobar.php3"
pt      // path to the pic (depending of quantity of path) "../pix/"
nop // the name of the pic "foo.jpg" altval // the word which will be shown in the alt tag of the pics reference "This is the foopic"
link    // where will the link go "newfoo.php"
orm     // a number to order the
sf      // showflag, to switch off unwanted/uncompleted pages
For pathinformations, I use an includefile which is included on every page. This holds the informations about tablewidth, pathes(oops that´s correct?), sitenames and everything the Site needs on every page. Now you just make a select like select * from menu where page="$PHP_SELF" where sf=1 order by orm And make your menu. If you put the menu in an extra page (or an object) you just have to include it on every "content page" and the work is done. echo '<table border="0" width="'.$tbwidth.'" cellpadding="0" cellspacing="0" summary="Menutable">' while($res=answer from db) {
        echo '<tr><td>'
        echo '<a href="'.$res[5].'?somevar=something">'
        echo '<img src="$res[2]" border="0" width="XX" height="YY" alt="$res[4]">
        echo '</a></td></tr>'
} echo '</table>' As you said you want to make a menu, width & height of the pics are known. Otherwise you shoul check them using fuctions from the graphic library. The Browsers are faster if they know exactly what the do. Maybe this gives you some understanding how to do it. Oliver (sorry all trailing ; are missing. It´s early today)

« previous php.general (#90335) next »