public function set_array($set_value) {
/*set empty class*/
$tempclass = new stdClass();
/*full Image path src*/
$search_dir = "/domain/img/company/Image1-000000-016";
/*open dir*/
$images = glob("$search_dir/*.*");
sort($images);
/*loop thought dir and get first Image*/
if (count($images) > 0) {
/*get product imagepath and set as src*/
$tempclass->src = $images[0];
/*return all data to array*/
$this->Imagedata[] = clone($tempclass);
}
}
My intention was to check my folder image and store first image to Imagedata[]
, but I keep checking the Imagedata[]
is empty, I don't know why. I checked the folderpath as well, it is correct so what did I do wrong?