I want the array ($img_array) to increase every time it's looped, but it wont. The length of the array is 0 when I echo it 'echo count(array);'
function imageSize($name, $nr, $category, $myarr){
$path = 'ad_images/'.$category.'/'.$name.'.jpg';
$path_thumb = 'ad_images/'.$category.'/thumbs/'.$name.'.jpg';
list($width, $height) = getimagesize($path);
list($thumb_width, $thumb_height) = getimagesize($path_thumb);
//$myarr = array();
$myarr['thumb_image_' . $nr . '_width'] = $thumb_width;
$myarr['thumb_image_' . $nr . '_height'] = $thumb_height;
$myarr['image_' . $nr . '_width'] = $width;
$myarr['image_' . $nr . '_height'] = $height;
return $myarr;
}
if ($nr_of_pics!=0){
$image_id = end( explode( '_', $ad_id ) );
$img_array = array();
for ($i=1; $i<=$nr_of_pics; $i++) {
${'image_src' . $i} = $image_id.'_'.$i;
imageSize(${'image_src' . $i}, $i, $category, $img_array);
}
}
echo count($img_array);
echo $img_array['image_3_width'];
Yanlış olan nedir?
ALSO, when I echo the $img_array element as you can see, it can't find it, says undefined index... BUT when I echo the element from INSIDE the function, it will work!
Eğer daha fazla girdi ihtiyacınız varsa bana bildirin ve ben bu Q güncelleyeceğiz
Teşekkürler