I need that to aloow .gif and .png not just allow .jpg . It has more code but you don't need that, it allows images uploaded in a folder to be allowed to be added to the database
<?
$query18 = "SELECT * FROM wilibfolders";
$result18 = mysql_query($query18, $db) ;
while ($row18 = mysql_fetch_array($result18))
{
$d = dir("albums/$row18[wilibfoldpath]");
while($entry=$d->read()) {
$lowletname = strtolower(substr($entry,-4,4));
if($lowletname== ".jpg")
{
$pathpicts="$row18[wilibfoldpath]/$entry";
$krk = substr_count("$pathpicts", "$pathr");
// zacni porovnavacku
if (($krk>=1) or ($g==50) or ($g==0)){
//echo $pathpicts." = ".$pathr."<br>";
$g=50;
// check for files in database
$checking = is_valid_jpg("albums/$row18[wilibfoldpath]/$entry");
$filesize = filesize ("albums/$row18[wilibfoldpath]/$entry");
$filesizer = humansize($filesize);
$xf=$xf+1;
$pathpict="$xf --> $filesizer --> $serverpath/albums/$row18[wilibfoldpath]/$entry";
echo "<b>".$xf."</b>. ==> "; ?><a href="<?echo $serverpath."/".$pathpicts?>"><?echo $serverpath."/".$pathpicts; ?></a><hr><?
$cest = $row18[wilibfoldepth];
$size = ReallyGetImageSize ("$serverpath/$row18[wilibfoldpath]/$entry");
//check if image is valid
// $im = @ImageCreateFromJPEG ("$serverpath/$row18[wilibfoldpath]/$entry");
// if (($checking>0) and ($im)) {
// if ($im) {
if (($checking>0) and ($size[0]<=$maxwidth) and ($size[1]<=$maxheight)) {
$sql17 = "INSERT INTO wilibpics (wilibpicnapath,wilibpicfoldepth,wilibnameofpic,wilibwidth,wilibheight,wilibpicfilesize) VALUES ('$pathpicts','$cest','$entry','$size[0]','$size[1]','$filesizer')";
$result17 = mysql_query($sql17,$db) ;
} else { echo "<BR>IMAGE ABOVE WAS NOT A VALID IMAGE<BR><HR>";}
}
if ($xf==(300$xa)) { echo "<br><Br><b>Please wait while automated system fetches all your images into mysql database.</b><br>";
$fr=(300$xa);
?>