I have made a little script for our site and thought I would share how I did it with everyone.
This will give you a directory dropdown list in your form, which we are using to choose pictures within a Directory.
Get rid of the space in the opening IMG tags, had to put a space in them to show up in here.
Create a Custom field in your form.
In the phpcode field add the following:
Code:
$answer = '<select id=" name="'.$formbit[id].'">';
$answer .= '<option>--Select Map--</option>';
$thisanswer = $q_{$formbit[id]};
$dirPath = dir('/path/to/image');
$imgArray = array();
while (($file = $dirPath->read()) !== false)
{
$imgArray[ ] = trim($file);
}
$dirPath->close();
sort($imgArray);
$c = count($imgArray);
for($i=0; $i<$c; $i++)
{
$answer .= '<option value="'.$imgArray[$i].'">'.$imgArray[$i].'';
}
$answer .= '</select>';
Change the following to suite the dir your images are in:
$dirPath = dir('/path/to/image');
Find in plugin Easy forms Part 1
Code:
/*($hook = vBulletinHook::fetch_hook('newthread_post_complete')) ? eval($hook) : false;*/
Replace with:
Code:
($hook = vBulletinHook::fetch_hook('newthread_post_complete')) ? eval($hook) : false;
To get the image to show up once the form is submited, enter the following in to the Custom Form Output, change the domain and directory to suit where the image is located:
Code:
[IMG ]http://www.yourdomain.com/images/maps/$q[39][/IMG]
There is probably an easier way of doing this, but hey it works.
Also if you wish to change the size of your images using the IMG tag then visit
http://tech.mikelopez.info/2006/03/0...resize-script/, and download their script.
This is how I used it: Custom Form Output
Code:
[IMG ]http://www.yourdomain.com/images/imgsize.php?w=250&h=250&constrain=1&img=/path/to/images/maps/$q[39][/IMG]
Replace $q[39] with your field number.
Again changing the domain and paths to suit. The paths are absolute, not relative.