$sql='SELECT sf.identifier, sf.storage, sfm.file FROM sys_file as sf, sys_file_metadata as sfm WHERE sfm.width=0 AND sfm.height=0 AND sf.uid = sfm.file';
$result=mysql_query($sql);
if(!$result){
echo"Could not successfully run query ($sql) from DB: ".mysql_error();
exit;
}
while($row=mysql_fetch_assoc($result)){
$filename=$row['identifier'];
if($row['storage']==1){
$filename='/fileadmin'.$filename;
}
$filename='..'.$filename;
$mime=mime_content_type($filename);
list($width,$height)=getimagesize($filename);
$sql='UPDATE sys_file_metadata SET width = \''.$width.'\', height = \''.$height.'\' WHERE file = '.$row['file'];
$r=mysql_query($sql);
if(!$r){
echo"Could not successfully run query ($sql) from DB: ".mysql_error();