I just found this and I think it will work with some tweaking...Any Comments welcome if you see something I don't. Thanks. Jon
18.4.2. How to choose images from a dropdown list
Isn't it more comfortable being able to choose the image for your review (if you are an administrator) from a dropdown list that offers the names of all available images in your image directory, rather than having to enter the full URL to the image each time? You could easily incorporate this functionality if you just cut and pasted the code from the admin/modules/topics.php file. The functionality is in the Topics module already - you don't need to write full URLs to the topics icons, do you?
The relevant part in the Reviews to introduce the code from the Topics module is the following code in modules/Reviews/index.php:
if(is_admin($admin)) {
echo "
<b>"._RIMAGEFILE.":</b><br>
<input type=\"text\" name=\"cover\" size=\"40\" maxlength=\"100\"><br>
<i>"._RIMAGEFILEREQ."</i><br><br>
";
}
Replace it with:
if(is_admin($admin)) {
echo "
<b>"._RIMAGEFILE.":</b><br>
echo "<select name="cover">";
$path1 = explode ("/", "images/reviews/");
$path = "$path1[0]/$path1[1]";
$handle=opendir($path);
while ($file = readdir($handle)) {
if ( (ereg("^([_0-9a-zA-Z]+)([.]{1})([_0-9a-zA-Z]{3})$",$file))
AND $file != "AllTopics.gif") {
$tlist .= "$file ";
}
}
closedir($handle);
$tlist = explode(" ", $tlist);
sort($tlist);
for ($i=0; $i < sizeof($tlist); $i++) {
if($tlist[$i]!="") {
if ($topicimage == $tlist[$i]) {
$sel = "selected";
} else {
$sel = "";
}
echo "<option name="cover" value="$tlist[$i]" $sel>$tlist[$i]n";
}
}
echo "</select><br>";
echo "<i>"._RIMAGEFILEREQ."</i><br><br>
";
}
The part of code that was stolen from the Topics module (from the admin/modules/topics.php file) is between the blank lines in the above code. It will offer you a dropdown list of all images in the images/reviews folder. Just like with the topics images, you must use all small letters and no underscores or other special characters. See choose image for review.
hogansbassets.com
eagleeye360.com
freight360.us