fixed cropping image

This commit is contained in:
2025-04-07 19:07:22 -06:00
parent 84d38dbeb3
commit e5b3e048b8
8 changed files with 44 additions and 33 deletions
+23 -16
View File
@@ -33,6 +33,10 @@ function logout()
unset($_COOKIE[$key]);
}
foreach (array_keys($_SESSION) as $key) {
unset($_SESSION[$key]);
}
header('Location: articles.php');
}
@@ -125,8 +129,8 @@ function signup_form($error_msg = '')
<label for="verify_password">Verify Password</label>
<input id="verify_password" name="verify_password" type="password" required>
<label for="profile_picture" class="upload_button modal_button" id="profile_cropper_button">Upload a Profile Picture</label>
<input id="profile_picture" class="file_input" name="profile_picture" type="file" accept="image/png, image/jpeg, image/jpg">
<label for="profile_picture_input" class="upload_button modal_button" id="profile_cropper_button">Upload a Profile Picture</label>
<input id="profile_picture_input" class="file_input" name="profile_picture" type="file" accept="image/png, image/jpeg, image/jpg">
<small class="file_input_feedback">No file selected.</small>
<label class="form_checkbox_container">Stay Logged In?
@@ -138,9 +142,8 @@ function signup_form($error_msg = '')
' . $error_msg . '
</form>
<div id="user_actions_modal" class="modal">
<div id="modal_content">
</div>
<div id="modal" class="modal">
<div id="display_modal"></div>
</div>
<div style="display: none;">
@@ -152,7 +155,7 @@ function signup_form($error_msg = '')
return $form;
}
function create_user($username, $email, $password, $verify_password, $role_id, $upload = null, $x = null, $y = null, $crop_width = null, $honeypot)
function create_user($username, $email, $password, $verify_password, $role_id, $upload = null, $x = null, $y = null, $crop_width = null, $honeypot = null)
{
if (!empty($honeypot)) {
$error_msg = '
@@ -378,15 +381,20 @@ function update_profile_picture_form()
<input type="hidden" name="crop_y" value="" id="crop_y">
<input type="hidden" name="crop_width" value="" id="crop_width">
<label for="profile_picture" class="upload_button modal_button" id="profile_cropper_button">Upload a Profile Picture</label>
<input id="profile_picture" class="file_input" name="profile_picture" type="file" accept="image/png, image/jpeg, image/jpg">
<label for="profile_picture_input" class="upload_button modal_button" id="profile_cropper_button">Upload a Profile Picture</label>
<input id="profile_picture_input" class="file_input" name="profile_picture" type="file" accept="image/png, image/jpeg, image/jpg">
<small class="file_input_feedback">No file selected.</small>
<input type="submit" class="button" value="Update Username">
<input type="submit" class="button" value="Update Profile Picture">
</form>
<script src="js/profile_picture_cropper_modal.js"></script>
<script src="js/upload.js"></script>
<div id="modal" class="modal">
<div id="display_modal"></div>
</div>
<div style="display: none;">
<div id="profile_cropper" class="modal_form">' . profile_cropper() . '</div>
</div>
</div>
';
@@ -585,9 +593,10 @@ function user_view($user_id)
<div class="line"></div>
';
// TODO: Need to setup an email handler.
// <a class="modal_button underline">Request Role</a>
// <div id="request_role_form" class="modal_form">' . request_role_change_form() . '</div>
// TODO: Allow user to update profile picture.
// <button id="update_profile_picture_form_button" class="modal_button underline">Update Profile Picture</button>
// <div id="update_profile_picture_form" class="modal_form">' . update_profile_picture_form() . '</div>
if ((isset($_COOKIE['user_id']) && $_COOKIE['user_id'] == $user_id) || (isset($_COOKIE['role_id']) && $_COOKIE['role_id'] <= 2)) {
$view .= '
<h3>User Actions</h3>
@@ -595,7 +604,6 @@ function user_view($user_id)
<button id="reset_pw_form_button" class="modal_button underline">Reset Password</button>
<button id="update_email_form_button" class="modal_button underline">Update Email</button>
<button id="update_username_form_button" class="modal_button underline">Update Username</button>
<button id="update_profile_picture_form_button" class="modal_button underline">Update Profile Picture</button>
<button id="request_role_form_button" class="modal_button underline">Request Role</button>
<button id="delete_account_form_button" class="modal_button underline">Delete Account</button>
</div>
@@ -608,7 +616,6 @@ function user_view($user_id)
<div id="reset_pw_form" class="modal_form">' . reset_pw_form() . '</div>
<div id="update_email_form" class="modal_form">' . update_email_form() . '</div>
<div id="update_username_form" class="modal_form">' . update_username_form() . '</div>
<div id="update_profile_picture_form" class="modal_form">' . update_profile_picture_form() . '</div>
<div id="request_role_change_form" class="modal_form">' . request_role_change_form() . '</div>
<div id="delete_account_form" class="modal_form">' . delete_account_form() . '</div>
</div>