fix photos

nid,$row->field_gallery_image_fid); while($row2=db_fetch_object($result2)) { echo "Entry for ".$row->fid."
"; if ($row->filepath == $row2->filepath) echo "match
"; else { echo "no match
"; //check if this file exists $result3 = db_query("select * from files where filepath = '%s'",$row->filepath); if ($row3 = db_fetch_object($result3)) { echo "new match found for ".$row3->fid.' '.$row2->nid.' '.$row2->field_gallery_image_fid.'
'; db_query('update content_field_gallery_image set field_gallery_image_fid=%d where content_field_gallery_image.nid=%d AND content_field_gallery_image.field_gallery_image_fid=%d',$row3->fid,$row2->nid,$row2->field_gallery_image_fid); } else { //insert echo "need to add new image
"; $filesarray = array(); $filesarray['uid'] = $row->uid; $filesarray['filename'] = $row->filename; $filesarray['filepath'] = $row->filepath; $filesarray['filemime'] = $row->filemime; $filesarray['filesize'] = $row->filesize; $filesarray['status'] = $row->status; $filesarray['timestamp'] = $row->timestamp; $filesobject = (object)$filesarray; //drupal_write_record('files',$filesobject); //db_query('update content_field_gallery_image set field_gallery_image_fid=%d where field_gallery_image.nid=%d AND field_gallery_image.field_gallery_image_fid=%d',$filesobject->fid,$row->nid,$row->field_gallery_image_fid); } } } } ?>