[Solved] Best method question |
My foreach loop picks up files and folders. But I am still having issue because when original_image is a folder it throws error.
Code: A PHP Error was encountered I am not sure the best method of where to use if is file or a if is dir? Because I use a input get as well. Any suggestions? PHP Code: $this->load->helper('directory');
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
The directory_map() function gives you back a nested array. If you loop through it you should perform an extra verification to check if the value is a string (containing your image file name) or an array (containing all the files in the sub directory).
PHP Code: foreach ($cached_images as $position => $image) {
(02-26-2016, 04:46 PM)Diederik Wrote: The directory_map() function gives you back a nested array. If you loop through it you should perform an extra verification to check if the value is a string (containing your image file name) or an array (containing all the files in the sub directory). thanks for that I will read more on is_string that is a new one for me.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
|
Welcome Guest, Not a member yet? Register Sign In |