PDA

View Full Version : make a message popup verifying avatar size


JIK1987
05-24-2011, 07:41 PM
When someone uploads an avatar I would like a message to pop up asking them to verify that they have uploaded an avatar that is the correct size. I have members who repeatedly do not upload the correct sized avatars. I have it set that if the wrong avatar is uploaded then it will stretch to fit, but it tends to look distorted.

kh99
05-28-2011, 04:58 PM
Maybe something like this: edit the modifyavatar template, find this (near the end)

<input type="submit" class="button" value="$vbphrase[save_changes]" accesskey="s" />
<input type="reset" class="button" value="$vbphrase[reset_fields]" accesskey="r" />


and replace with this:

<input type="submit" class="button" value="$vbphrase[save_changes]" accesskey="s" onclick="return show_reminder(this.form.avatarid)"/>
<script type="text/javascript">
function show_reminder(avataridObj)
{
if (!($permissions[avatarmaxwidth] || $permissions[avatarmaxheight]))
return true;
var value = -1;
for (var i=0; i<avataridObj.length; i++) {
if (avataridObj[i].checked) {
value = avataridObj[i].value;
break ;
}
}
if (value == 0)
{
return confirm("Are you sure the image is within the size limits ($permissions[avatarmaxwidth] x $permissions[avatarmaxheight])?");
}
return true;
}
</script>
<input type="reset" class="button" value="$vbphrase[reset_fields]" accesskey="r" />


(You could put the js function in the script tag that's already at the top of the template, but this way I only had to describe one replacement).