Ben böyle bir dizi oluşturma:
function imageSize($name, $nr, $category){
$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;
}
I have hidden inputs on my page which values are taken from the array like this: (FIRST)
<input type="hidden" id="img1_width" value="<?php echo $img_array['image_1_width'];?>" />
<input type="hidden" id="img1_height" value="<?php echo $img_array['image_1_height'];?>" />
<input type="hidden" id="img1_th_width" value="<?php echo $img_array['thumb_image_1_width'];?>" />
<input type="hidden" id="img1_th_height" value="<?php echo $img_array['thumb_image_1_height'];?>" />
(SECOND)
<input type="hidden" id="img2_width" value="<?php echo $img_array['image_2_width'];?>" />
<input type="hidden" id="img2_height" value="<?php echo $img_array['image_2_height'];?>" />
<input type="hidden" id="img2_th_width" value="<?php echo $img_array['thumb_image_2_width'];?>" />
<input type="hidden" id="img2_th_height" value="<?php echo $img_array['thumb_image_2_height'];?>" />
Sadece 1 resim, daha sonra dizisi yalnızca KEZ adı verilecek ve ikinci görüntüyü çağırır girişler ('id' = 'img2' vb ile tüm girişler) varsa Şimdi, [(0)] {değerine sahip olacak }
My Q is this: Is there any way I can check the array length and set the remaining values all to '0' (zero) if they are not set?
Teşekkürler