thechris Posted January 27, 2007 Share Posted January 27, 2007 I looked on the nulavatar forums already but couldn't find anything and I looked through the faq for it but couldn't find anything wrong there either.What i'm getting is the warningWarning: sort() expects parameter 1 to be array, null given in /Users/chrismorlang/Sites/admin/admin_nulavatar.php on line 674here is the code[code]//// [START] Add image//if($action == "addimage"){ $location = '<a href="'.append_sid($file.'?action=images').'" class="nav">'.$lang['nulavatar_loc_images'].'</a> -> <a href="'.append_sid($file.'?action=addimage').'" class="nav">'.$lang['nulavatar_loc_addimage'].'</a>'; // // [START] Create list with images! // $dir = @opendir($phpbb_root_path . $sprites_path); $firstimage = ''; while($file = @readdir($dir)) { if( !@is_dir(phpbb_realpath($phpbb_root_path . $sprites_path . '/' . $file)) ) { $img_size = @getimagesize($phpbb_root_path . $sprites_path . '/' . $file); if( ($img_size[0] == $img_width) && ($img_size[1] == $img_height) ) { $sprite_images[] = $file; } } } @closedir($dir); sort($sprite_images); //LINE GIVING ME THE PROBLEM $i_list = ""; for( $i = 0; $i < count($sprite_images); $i++ ) { if ($firstimage == '') { $firstimage = $sprite_images[$i]; } $i_list .= '<option value="' . $sprite_images[$i] . '">' . $sprite_images[$i] . '</option>'; } // // [END] Create list with images! // $sql = "SELECT * FROM ".$table_prefix."nulavatar_layers ORDER BY position DESC"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, "<b>Fatal Error!</b><br />".mysql_error()); } $l_list = ''; for( $i = 0; $i < mysql_num_rows($result); $i++ ) { $row = mysql_fetch_array($result); $l_list .= '<option value = "'.$row['id'].'">'.str_replace("_"," ",$row['name']).'</option>'; } $noshow = '<option value = "">'.$lang['nulavatar_dont_use_nolayer'].'</option>'; $useaction = ' <tr><td class="row1" align="center"><span class="gen"> <br /><b>'.$lang['nulavatar_addimage'].'</b><br /><br /> <form action="" method="post"> <table width="60%" cellpadding="10" cellspacing="0"> <tr> <td width="40%" class="row2"><span class="gen"><b>'.$lang['nulavatar_name'].'</b></span></td> <td width="60%" class="row2"><span class="gen"><input type="text" name="name" value=""></span></td> </tr> <tr> <td width="40%" class="row2"><span class="gen"><b>'.$lang['nulavatar_image'].'</b></span></td> <td width="60%" class="row2"><span class="gen"><img src="'.$phpbb_root_path.$sprites_path.'/'.$firstimage.'" name="preview"><br /><select name="image" onChange="document.images[\'preview\'].src = \''.$phpbb_root_path.$sprites_path.'/\'+ this.value;">'.$i_list.'</select></span></td> </tr> <tr> <td width="40%" class="row2"><span class="gen"><b>'.$lang['nulavatar_layer'].'</b></span></td> <td width="60%" class="row2"><span class="gen"><select name="layer">'.$l_list.'</select></span></td> </tr> <tr> <td width="40%" class="row2"><span class="gen"><b>'.$lang['nulavatar_dontshowlayer'].'</b></span><span class="gensmall"><br />'.$lang['nulavatar_dontshowlayer_explain'].'</span></td> <td width="60%" class="row2"><span class="gen"><select name="dontshowlayer">'.$noshow.$l_list.'</select></span></td> </tr> <tr> <td width="40%" class="row2"><span class="gen"><b>'.$lang['nulavatar_itemneeded'].'</b></span><span class="gensmall"><br />'.$lang['nulavatar_itemneeded_explain'].'</span></td> <td width="60%" class="row2"><span class="gen"><input type="text" name="itemneeded" value=""></span></td> </tr> </table> <br /> <input type="hidden" name="action" value="doaddimage"><input type="submit" class="mainoption" value="'.$lang['nulavatar_addimage'].'"><br /><br /></span></th> </form> </span></td></tr> ';}//// [END] Add image//[/code] Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 27, 2007 Share Posted January 27, 2007 It means there is no value to that array. before while($file = @readdir($dir))add $sprite_images = array();And take off all the @s so you can get the errors from readdir and other functions. There's your problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.