$filename\n"); rename("$image_path/$originalName", "$image_path/$filename"); $imagesChanged[] = array($originalName, $filename); } // Resize image and create thumbnail resizeImage($filename, $image_path, 1000, 200); } if (count($imagesChanged)) { echo("======================\n"); echo("======================\n"); $query = "SELECT * FROM formatted_content WHERE school_num = $school_num"; $results = db_query($query); while ($row = db_fetch_assoc($results)) { $record_num = $row['record_num']; $content = $row['content']; $content_id = $row['content_id']; $ocontent = $content; for ($i = 0; $i < count($imagesChanged); $i++) { $oimage = $imagesChanged[$i][0]; $nimage = $imagesChanged[$i][1]; $content = str_replace($oimage, $nimage, $content); if (strpos($oimage, ' ') !== false) { $oimage = str_replace(' ','%20',$oimage); $content = str_replace($oimage, $nimage, $content); } } if ($ocontent != $content) { echo("ID: $content_id\n"); echo($ocontent); echo("\n"); echo("----------------------------------------\n"); echo($content); echo("\n"); $content = db_escape_string($content); $query = "UPDATE formatted_content SET content = \"$content\" WHERE record_num = $record_num"; db_query($query); } else { echo("No Change\n"); } echo("\n"); } // exit(); } } ?>