On Saturday, September 08, 2012 11:19:29 PM David McGlone wrote:
> On Saturday, September 08, 2012 03:49:27 PM you wrote:
> > <?php
> >
> > function completeImageFilename($prefix)
> > {
> >
> > $matches = glob('images/property_pics/'.$prefix.'*');
> > return $matches[0];
> >
> > }
> >
> > echo '<img src="'.completeImageFilename($row['MSL_No']).'" />';
> >
> > ?>
> >
> > If you need to extract more than one image filename you should be able to
> > modify that pretty easily.
>
> YEOW! LOL I looked at this and I'm very stumped on 1 thing. How in the world
> did you get $prefix to contain the image name without first assigning it to
> $prefix? I understand the rest, but..... Holy smokes, that's blown my mind.
I read about glob() on php.net before I replied, but I believe now it's
registering. From what I understand glob works just like opendir() but does
everything all in just 1 function. so in your code I realize you passed the
variable $prefix into glob, along with the path to the files. This put the path
images/property_pics/ and each image name from glob into $prefix you then
assigne the value of $glob to $matches. Sound about right? :-)
--
Regards
David M.