Image uploads and avatars


(Varun) #1

So these are two really basic questions that have probably been asked before, but I haven’t been able to find any relevant topics using the search function

  • To save some disk space I would like to disable image uploads in posts. The issue with setting ‘max image size kb’ to 0 is that it seems to disable profile picture uploads as well, which is something I want to keep. Is there any way to disable image uploads only on posts but keep the option for uploading profile pictures + profile covers?
  • I would like to make the user avatar size on posts bigger (80 x 80 to be precise). However avatar images seem to be saved as 45 x 45 images, which means the image obviously looks bad when it’s scaled. Is there any way to change the size the avatars are saved as?

Again, apologies if these questions have already been covered before!


(Jeff Atwood) #2

Unfortunately I do not think there is any way to do either of these things at the moment. Larger avatar is available though as you can see on the user profile page!


(Varun) #3

Thanks for pointing this out! I shoved this bit of javascript into the header section of my customisation page and it uses the 120 x 120 images on posts now

<script type="text/javascript">

Discourse.Route.reopen({
    activate: function() {
        this._super();
        Em.run.next(function(){
            
            change(); 

        });
    } 
});

function change()
{
    $(".topic-avatar .avatar").each(function(i, obj){
        avatarLink = $(this).attr("src").split("/"); 
        if(avatarLink[1] == "user_avatar") { 
	        avatarLink[4] = "120";
	        var finalLink = avatarLink[0] + "/" + avatarLink[1] + "/" + avatarLink[2] + "/" + avatarLink[3] + "/" + avatarLink[4] + "/" + avatarLink[5];
	        alert(finalLink);
	        $(this).attr("src", finalLink);
        }
    });
}

It’s pretty ugly and probably really inefficient but it gets the job done

EDIT - unfortunately it seems that the JS doesn’t fire when I switch over to another topic, and only applies when I actually refresh the page again? Is there any way to make it fire on topic change?


#4

I would also like to request this feature. I prefer for users to only link to external images in their posts, to save bandwidth and disk space. But I do want avatar uploading.


(Mittineague) #5

Did you already try using Mutation Observer?

* be careful, it can be a massive memory hog


(Stephen Kerr Jr) #6

I would love to use a higher quality avatar as well. Any news on making this available soon? or some sort of hack that will let us do it?


(Jacob Chapel) #7

Here is a post on exactly how to increase your avatar size if you so choose.