BuddyDev

Search

[Resolved] Cropping of cover image

  • Participant
    Level: Yogi
    Posts: 1114
    calu on #33832

    Hi Brajesh, this is a question which has been asked, and answered before, but I’m still not able to get an acceptable solution to the cropping of the cover image.

    Why is the cover image cropped at all, compared to the original, and how do I solve it?

    Original:
    https://imgur.com/SlGD0Tu

    Desktop:
    https://imgur.com/e1M6XU7

    On mobile the cover image is useless:

    https://imgur.com/HvAQ9wP

    I found this code, here: https://buddydev.com/support/forums/topic/cover-image-cropping-function/

    function buddydev_enable_crop_for_cover_image( $args ) {
    	$args['crop'] = true;
    
    	return $args;
    }
    add_filter( 'bp_after_attachment_cover_image_edit_image_parse_args', 'buddydev_enable_crop_for_cover_image' );
    

    But it does nothing to my cover image.

    Regards
    Carsten

  • Keymaster
    (BuddyDev Team)
    Posts: 24611
    Brajesh Singh on #33838

    Hi Carsten,
    Thank you for the question.

    1. You can set the height/width via a filter
    2. The above code only applies on new uploads

    3. Until there is multiple cover size available, the best way to achieve good results will be to use css background properties to achieve the result. I will suggest looking into background-size and background-position for the same.

    Regards
    Brajesh

  • Participant
    Level: Yogi
    Posts: 1114
    calu on #33847

    Hi Brajesh, thanks for the explanation, I will follow your advice, and hope that BP some day will add some options for the cover image.

    Regards
    Carsten

  • Keymaster
    (BuddyDev Team)
    Posts: 24611
    Brajesh Singh on #33855

    Thank you and I do hope so. Having multiple image size will be a boon.

The topic ‘ [Resolved] Cropping of cover image’ is closed to new replies.

This topic is: resolved