Best Method For Getting Array Of Image Paths?

Hi,

I am currently using prettyPhoto for display a gallery on a site I am working on. I was just wondering if there is a recommended method for getting an array of the image paths? Is there a Yii class to do this or should I be using something like dir()?

Thanks in advance,

U4EA

I have managed to use dir to get an array from the folder. I have then tried to echo it and have brought up this…




<img src="C:/xampp/htdocs/development/photo_final/images/gallery/newborns/1.jpg" width="85" height="85" />

This is not displaying the image. However, this is…




<img src="/development/photo_final/images/gallery/newborns/1.jpg" width="85" height="85" />

Can someone tell the reason for this and is there any solution?

They are 2 different paths:

/development/photo_final

/development/mandy_final

Sorry about that - that was a mistake when I was pasting the code into this forum and is not reflective of the code I have on the site and, therefore, nothing to do with the error.

Anyone? I would really appreciate any input as I am running behind the deadline in getting this client’s site finished and this is the last thing that needs done to it.

The first one is a PATH, you need to use a URL.


<img src="<?php echo Yii::app()->request->baseUrl; ?>/images/gallery/newborns/1.jpg" width="85" height="85" />

Do you know a suitable method for getting an array of the the URLs of jpegs within a certain folder?

http://stackoverflow…b=votes#tab-top




$imageList = array();


foreach(glob('./images/*.*') as $filename){

    $imageList[] = Yii::app()->request->baseUrl . "/images/".$filename;

}

Matt

Got it working perfectly now! Thanks!