help How to add an avatar
help How to add an avatar
I don't understand how to add an avatar to a profile, please help me
-
- Posts: 29
- Joined: Thu Mar 09, 2023 12:25 pm
Re: help How to add an avatar
To shows in the user's profile. Create User Lister.
Enter codes
Enter Config
---------------------------------------------------
To upload the photo.
Create a User Editor
Enter codes
Enter Config
Add this script to the page as well.
I haven't tested it, but it should be fine.
Enter codes
Code: Select all
<img src="{{VALUE(%avatar%)@OR(https://img.wapka.org/000ans.jpg)}}"/>
Code: Select all
<id>{{GET(id)}}</id>
---------------------------------------------------
To upload the photo.
Create a User Editor
Enter codes
Code: Select all
<div class="aside" style="text-decoration:none">
<a id="upload">
<img src="https://cdn.wapka.org/008gzn/0ea909af1a01f6a437b63d7e50148208/upload-gb19933c89_640.png" height="30" width="30"/> <br/>
Trocar foto de perfil!
</a><br/>
<input style="display:none" name="avatar" value="%avatar%" id="loadavt" type="text" readonly>
<input style="display:none" type="file" id="f" accept="image/*">
</div>
Enter Config
Code: Select all
<USERID>{{VAR(USER_ID)}}</USERID>
<SET_AVATAR>{{POST(avatar)}}</SET_AVATAR>
Add this script to the page as well.
Code: Select all
<script>function imgur(e,a){document.querySelector(e).onchange=function(){var e=this.files[0];if(e&&e.type.match(/image.*/)){var t=new FormData;t.append("image",e);var n=new XMLHttpRequest;n.open("POST","https://api.imgur.com/3/image.json"),n.upload.onprogress=function(e){if(e.lengthComputable){var t=Math.floor(e.loaded/e.total*100)+"%";a.loading(t)}},n.onload=function(){var e=JSON.parse(n.responseText);if(200===e.status&&!0===e.success){var t=e.data;a.loaded(t.link,t.type,t.size,t.datetime)}else window.alert("Lỗi: tải lên thất bại")},n.setRequestHeader("Authorization","Client-ID aacca020023959a"),n.send(t)}else window.alert("Chỉ cho phép chọn ảnh")}}document.querySelector("#upload").onclick=function(){document.querySelector("#f").click()},imgur("#f",{loading:function(e){document.querySelector("#upload").innerHTML='Tudo deu certo!'+e+" <br/>"},loaded:function(e,a,t,n){var o=$("input#loadavt").val();$("input#loadavt").val(e),document.querySelector("#upload").innerHTML='Upload feito!<br/>Agora salve.'}});</script>