okay i need help searching for an image
i'm trying to search with an "*"
but its not working
basically i'm looking for any file that ends in
_$_GET[DNID]_p1
so it could be
1_2_p1
2_2_p1
89_2_p1
bob_2_p1
smelly_bob_2_p1
$img1 = "*_$_GET[DNID]_p1";
if(file_exists("$img1"))
{print("<a href=\"javascript:popUp('$img1')\"> <img src='$img1' width='150' height='150' border=0></a>");}
else
{print(" <a href=\"javascript:popUp('up.php?P=p1&W=def')\">Upload Image 1</a> ");}
searching a directory for a image
Moderator: General Moderators
-
penguinboy
- Forum Contributor
- Posts: 171
- Joined: Thu Nov 07, 2002 11:25 am
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
superwormy
- Forum Commoner
- Posts: 67
- Joined: Fri Oct 04, 2002 9:25 am
- Location: CT
Are you on a Linux server? You could use something like this:
shell_exec ("find ... [filename and params here, see man find under linux]");
And then print those results. Might also be worth looking into putting info into database, ie name the images just by the record Index in the database, then search the database.
shell_exec ("find ... [filename and params here, see man find under linux]");
And then print those results. Might also be worth looking into putting info into database, ie name the images just by the record Index in the database, then search the database.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You could also loop through the directory and use a regular expression to find matches:
http://www.php.net/manual/en/ref.dir.php
http://www.php.net/manual/en/ref.pcre.php
Mac
http://www.php.net/manual/en/ref.dir.php
http://www.php.net/manual/en/ref.pcre.php
Mac