mysql_connect('localhost', 'root', '');
mysql_select_db('slider');
function getImg() {
$path = 'images';
$scanPath = scandir($path);
$countPath = count($scanPath);
for($i = 0; $i < $countPath; $i++){
if(!getimagesize($path.'/'.$scanPath[$i]))
continue;
else {
$result = mysql_query('SELECT id FROM slides WHERE name = "'.$scanPath[$i].'"');
if(mysql_fetch_array($result))
continue;
$infoImg = getimagesize($path.'/'.$scanPath[$i]);
$size = $infoImg[0].'x'.$infoImg[1];
mysql_query('INSERT into slides (name,size) VALUES ("'.$scanPath[$i].'","'.$size.'")');
}
}
}
getImg();
Warning: getimagesize(images/..): failed to open stream: Permission denied in H:\home\slides\www\index.php on line 11
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in H:\home\slides\www\index.php on line 15
При попытки записи в базу, как быть?