I have a manually filled array with directory names that are used to run a function for image modification. Number and names of these directories changes frequently, so to simplify it I scan the main directory to get the names of the subdirectories. The problem is that the format of this directory array is not as I need it.
This is the manually filled array:
$aManipulations = array(
array('x109_110x110'),
array('x1380'),
array('x1800'),
array('x2012'),
array('x387'),
array('x40'),
array('x561'),
array('x60'),
array('x640'),
array('x669'),
array('x671'),
array('x700'),
);
Result:
Array
(
[0] => Array
(
[0] => x109_110x110
)
[1] => Array
(
[0] => x1380
)
[2] => Array
(
[0] => x1800
)
[3] => Array
(
[0] => x2012
)
[4] => Array
(
[0] => x387
)
[5] => Array
(
[0] => x40
)
[6] => Array
(
[0] => x561
)
[7] => Array
(
[0] => x60
)
[8] => Array
(
[0] => x640
)
[9] => Array
(
[0] => x669
)
[10] => Array
(
[0] => x671
)
[11] => Array
(
[0] => x700
)
)
Other array generated by scan dir:
$dir = glob('images/onthefly/products/' . '*', GLOB_ONLYDIR);
$dir = str_replace("images/onthefly/products/", "", $dir);
$aManipulations = array(
array($dir),
);
Result:
Array
(
[0] => Array
(
[0] => Array
(
[0] => x109_110x110
[1] => x1380
[2] => x1800
[3] => x2012
[4] => x387
[5] => x40
[6] => x561
[7] => x60
[8] => x640
[9] => x669
[10] => x671
[11] => x700
)
)
)
So what has to be done to transform the automatically filled array?
###################### Update ######################
foreach ($aManipulations as $aManipulation) {
smarty_modifier_manipulateImage(
DIR_WS_ORIGINAL_IMAGES . $aQuery['products_image'],
$aManipulation[0],
isset($aManipulation[1]) ? $aManipulation[1] : '',
isset($aManipulation[2]) ? $aManipulation[2] : false
);
}
$dirarray rather than putting it in another array i,e,$aManipulations = array( array($dir) );would be even more logical. why bury an array in an array when there is only one array