} unset($litqresult); } } } // We end the DB transaction here. //$connection->commit(); // 9. Generate thumbnail and save images to file storage (outside tx) if ($image_name != "") { $resourcedir = '/tmp/'; $user_image_location = $resourcedir . $modified_image_name; if (!move_uploaded_file($_FILES['upload_image']['tmp_name'], $user_image_location)) { throw new Exception("Error moving uploaded file to {$modified_image_name}"); } $thumb_location = $resourcedir . $imagethumb; ImageUtil::createThumb($user_image_location, $thumb_location, 120, 120); if (!isset($fs)) { $fs = FileSystem::getInstance(); } if (!$fs->create($user_image_location, "NO_OP", "NO_OP")) { error_log("Error copying image " . $user_image_location); } if (!$fs->create($thumb_location, "NO_OP", "NO_OP")) { error_log("Error copying thumb " . $thumb_location); } unlink($user_image_location); unlink($thumb_location); } // 10. Save literature file to storage if ($literature_name != "") { $lit_resourcedir = '/tmp/';
$telephone = $_POST['telephone']; $timezone = $_POST['timezone']; $image_name = basename($_FILES['user_image']['name']); $geocode = new Geocoder($street1, $city, $state, $zip); if ($image_name != "") { $pos = strpos($image_name, '.'); $img_ext = substr($image_name, $pos, strlen($image_name)); $modified_image_name = "P" . $username . $img_ext; $resourcedir = '/tmp/'; $user_image_location = $resourcedir . $modified_image_name; if (!move_uploaded_file($_FILES['user_image']['tmp_name'], $user_image_location)) { throw new Exception("Error moving uploaded file to {$user_image_location}"); } $imagethumb = "P" . $username . "T" . $img_ext; $thumb_location = $resourcedir . $imagethumb; ImageUtil::createThumb($user_image_location, $thumb_location, 133, 99); $fs = FileSystem::getInstance(); if (!$fs->create($user_image_location, "NO_OP", "NO_OP")) { error_log("Error copying image " . $user_image_location); } if (!$fs->create($thumb_location, "NO_OP", "NO_OP")) { error_log("Error copying thumb " . $thumb_location); } unlink($user_image_location); unlink($thumb_location); } else { $imgquery = "select imageurl from PERSON where username='******' "; $connection->beginTransaction(); $imgresult = $connection->query($imgquery); while ($imgresult->next()) { $modified_image_name = $imgresult->get(1);