Almost every user on this site has or had at least one image in the profile, whether as an avatar, personal photo or as a signature
and went through the upload process.
In the example of a personal photo, it's saying
All photos must be no larger than 100 kilobytes and no bigger than 192 px by 192 px.However, nothing stops a user from uploading a photo with an arbitrary size, let's say 3 MB instead of the allowed 100 kilobytes - no checks are done here.
There are surely (some) members who see other users with inapprioprate images and report them, but if you could automatically reject oversized images
before they can even be uploaded and applied to the users profile, no reports would be needed at all (in terms of image size).
In addition, users as well as this site would save some energy and memory since oversized images cannot be uploaded and used.
What is more, both the d2jsp staff as well as we the members would not annoy each other for breaking this rule. Some people break this rule on purpose,
but there are definitely people who accidently break it because it might not be as obvious to see that there are limits in size. An automation would solve all these problems.
Additional stuff:
Here is an example in javascript (addon: Tampermonkey). If you know how to run these scripts, you can visit the link
inside it (
https://imgur.com/ZxqVGwu) and run the script. It will print you the size of the image in kilobytes.
Code
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://imgur.com/ZxqVGwu
// @grant none
// ==/UserScript==
var req = new XMLHttpRequest();
req.open('HEAD', 'https://i.imgur.com/ZxqVGwu.png', true);
req.onreadystatechange = function(){
if (req.readyState == 4) {
if (req.status == 200) {
alert('Size: ' + req.getResponseHeader('Content-Length')/1000 + ' kilobytes');
}
}
};
req.send();
And then if image size greater than allowed size, reject upload..
I see only one problem within the implementation: Due to the Same Origin Policy, this script will only work under the same origin.
I'm not that professional in javascript anyway but I couldn't find another way of getting the size of an image directly from this site.
You need to visit the site where the image has been uploaded in order to get the image size. But I can totally imagine that in case you are supporting this idea
and try to implement it, you will find a more efficient way of doing it... ^^
This post was edited by OnChair on Oct 9 2019 07:37am