• Resolved maruyamah

    (@maruyamah)


    I’ve created custom badges that I’d like to use on our site. They are square, 1000x1000px images originally. I’ve tried resizing them and have made them both pngs and jpgs (they’re square without a clear background so it doesn’t really matter) but as soon as they are converted into thumbnails, they become incredibly pixelated. The non-thumbnail version of them looks fine. Is there a way to fix this? I’d rather just use the bigger image and get rid of the thumbnail all together if possible, but I’d settle for the badge being not pixelated.

    https://www.ads-software.com/plugins/badgeos/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter maruyamah

    (@maruyamah)

    The other thing is that it reduces my thumbnails to a 100×100 file but the default image still uses its original file. Would it be possible to find a way to do the same with user generated thumbnails?

    Thread Starter maruyamah

    (@maruyamah)

    Actually, someone in my office figured this out. The thing that was causing the problem was the function register_image_sizes() in badgeos.php in the main section of the folder. We changed the size to 300×300 and it looks fine now.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    Changing that value isn’t the proper fix for this, to be honest. All that line does is add an extra size to resize uploads to, it doesn’t play a part in which image size to fetch for the display.

    The better route would be to filter the returned results of badgeos_render_achievement() which is what we use to render achievements. It has all of its output run through a filter named badgeos_render_achievement and includes the achievement ID for conditional display if necessary.

    Part of the output from the render achievement function is a call to badgeos_get_achievement_post_thumbnail(), and out of the box, it just passes in the achievement ID in the first param. You’d want to utilize at least the first 2 parameters, with the second being the image size to use.

    Associated files at the correct lines:
    https://github.com/opencredit/badgeos/blob/master/includes/content-filters.php#L375
    https://github.com/opencredit/badgeos/blob/master/includes/achievement-functions.php#L527

    This was a bit complex for me but if i’ve understood correctly i changed line 539 to look like this:

    function badgeos_get_achievement_post_thumbnail( $post_id = 0, $image_size = ‘300px’, $class = ‘badgeos-item-thumbnail’ ) {

    and it worked, no more grainy images, but that seemed to easy did i do something wrong?

    Thanks

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    robinhind, that’s going to change the default size used for the function delcaration. In some cases that would return the image size you are wanting, but it’s not the best way to go about this. It’s also not something that would be retained during any future updates to the plugin, and would just get overwritten.

    The better method here would be to determine where the function is being used, for your situation, and pass in the 300px at that point. Hopefully the spot in question is in a place that has a filter available for it, so that you can do this safely without editing the core code in another location. Part of why I pointed out the badgeos_render_achievement filter above, so you could change the output safely from a different spot like your functions.php file for your current theme.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘BadgeOS Thumbnails Look Pixelated’ is closed to new replies.