Added a Feature
This commit is contained in:
parent
6942177fe7
commit
e025864f29
1 changed files with 15 additions and 1 deletions
|
@ -107,12 +107,17 @@
|
||||||
<input type="file" class="custom-file-input" id="jsprofilePictureInputFile" name="profilePictureInputFile">
|
<input type="file" class="custom-file-input" id="jsprofilePictureInputFile" name="profilePictureInputFile">
|
||||||
<label class="custom-file-label" for="jsprofilePictureInputFile"><?php $L->p('Upload image'); ?></label>
|
<label class="custom-file-label" for="jsprofilePictureInputFile"><?php $L->p('Upload image'); ?></label>
|
||||||
</div>
|
</div>
|
||||||
<!-- <button id="jsbuttonRemovePicture" type="button" class="btn btn-primary w-100 mt-4 mb-4"><i class="fa fa-trash"></i> Remove picture</button> -->
|
<button id="jsbuttonRemovePicture" type="button" class="btn btn-primary w-100 mt-4 mb-4"><i class="fa fa-trash"></i> Remove picture</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-8 col-sm-12 p-0 text-center">
|
<div class="col-lg-8 col-sm-12 p-0 text-center">
|
||||||
<img id="jsprofilePicturePreview" class="img-fluid img-thumbnail" alt="Profile picture preview" src="<?php echo (Sanitize::pathFile(PATH_UPLOADS_PROFILES.$user->username().'.png')?DOMAIN_UPLOADS_PROFILES.$user->username().'.png?version='.time():HTML_PATH_CORE_IMG.'default.svg') ?>" />
|
<img id="jsprofilePicturePreview" class="img-fluid img-thumbnail" alt="Profile picture preview" src="<?php echo (Sanitize::pathFile(PATH_UPLOADS_PROFILES.$user->username().'.png')?DOMAIN_UPLOADS_PROFILES.$user->username().'.png?version='.time():HTML_PATH_CORE_IMG.'default.svg') ?>" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--This Deletes The Profile Picture-->
|
||||||
|
<?php
|
||||||
|
if(isset($_GET['deleteID']))
|
||||||
|
echo unlink(PATH_UPLOADS_PROFILES.$user->username().'.png');
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
// $("#jsbuttonRemovePicture").on("click", function() {
|
// $("#jsbuttonRemovePicture").on("click", function() {
|
||||||
|
@ -121,6 +126,15 @@
|
||||||
// $("#jsprofilePicturePreview").attr("src", "<?php echo HTML_PATH_CORE_IMG.'default.svg' ?>");
|
// $("#jsprofilePicturePreview").attr("src", "<?php echo HTML_PATH_CORE_IMG.'default.svg' ?>");
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
//Ajax to Remove the file
|
||||||
|
$("#jsbuttonRemovePicture").on("click", function() {
|
||||||
|
$.ajax({
|
||||||
|
type:"GET",
|
||||||
|
data:{"deleteID":'<?php echo $user->username(); ?>' }
|
||||||
|
})
|
||||||
|
$("#jsprofilePicturePreview").attr("src", "<?php echo HTML_PATH_CORE_IMG.'default.svg' ?>");
|
||||||
|
})
|
||||||
|
|
||||||
$("#jsprofilePictureInputFile").on("change", function() {
|
$("#jsprofilePictureInputFile").on("change", function() {
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
formData.append('tokenCSRF', tokenCSRF);
|
formData.append('tokenCSRF', tokenCSRF);
|
||||||
|
|
Loading…
Add table
Reference in a new issue