Welcome Guest, Not a member yet? Register   Sign In
directory_map() not working returns bool(false)
#1

(This post was last modified: 01-27-2016, 06:04 AM by vilasgalave.)

I have different image folders under 'Property gallery' directory e.g. 'Property gallery/pro_1'. Here I want to fetch full paths of all the images inside the specified folder. I used directory_map() but it doesn't return anything. 
My code is: 
Code:
$image_path = $row['image_path'];//stored in database as 'Property gallery/Ganesh Kripa/'
/*--get all images in directory--*/
$map = directory_map($image_path);
var_dump($map);
//print_r($map);
foreach ($map as $result)
{
       $get_result = $image_path.$result;
    array_push($img_array,$get_result);
}


 var_dump($map) returns bool(false) and then error at foreach loop i.e. 'Invalid argument supplied for foreach()' occurs. 
I set to autoload the url, form, path and directory helpers and my base url is 
Code:
http://localhost:8081/SVN_propertybooking/branches/dev/Admin/
 
And under Admin directory there is Property gallery folder .
I'm new in codeigniter, any help will be appreciated.
My folder structure is

->Admin
     -> application
     -> assets
          -> Property gallery
              -> Ganesh Kripa
     -> system
Reply
#2

If you look at the directory_map helper its path takes a ./ in front of the directory name.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

I tried but still not working same error occurs. Please see my newly edited question, added folder structure.
Reply
#4

$map = directory_map('./'.$image_path);
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

its worked..! Thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB