• Resolved kayapati

    (@kayapati)


    Can you tell me which files I need to make changes so that I will get profile image height is more than width?

    https://kayapati.com/demos/alexia/photographers/

    Here I almost completed my site and but badly need to make them more professional.

    I suggest you people to give an option in “Ultimate Member > Settings > Uploads ” where you provided the “Profile Photo Thumbnail Sizes (px)” here you can also give an option to make profile image height.

    I tried “um-corp.js” file, but could not get it, it would be appreciated if you can tell me which function or code or line number is goo enough.

    • This topic was modified 5 years, 3 months ago by kayapati.
Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kayapati

    You can try this filter hook to customize the size:

    + um_upload_image_process__profile_photo
    Parameters:
    $response
    $image_path
    $src
    $key
    $user_id
    $coord
    $crop

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kayapati

    Here’s the code snippet:

    <?php
    add_filter("um_upload_image_process__profile_photo","um_custom_profile_photo_size", 1, 7 );
    function um_custom_profile_photo_size( $response, $image_path, $src, $key, $user_id, $coord, $crop ){
      
    			$quality = UM()->options()->get( 'image_compression' );
    
    			$image = wp_get_image_editor( $image_path ); // Return an implementation that extends WP_Image_Editor
    
    			$temp_image_path = $image_path;
    			//refresh image_path to make temporary image permanently after upload
    			$image_path = pathinfo( $image_path, PATHINFO_DIRNAME ) . DIRECTORY_SEPARATOR . $key . '-custom.' . pathinfo( $image_path, PATHINFO_EXTENSION );
    
    			if ( ! is_wp_error( $image ) ) {
    				
    				$image->resize( 200, 600, true );
    				
    				$image->set_quality( $quality );
    
    				$image->save( $image_path );
    
    				
    				
    			} 
    }
    ?>

    Regards,

    Thread Starter kayapati

    (@kayapati)

    Thank you very much for the code, but I am a designer and can you tell me where this code should go?

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kayapati

    You can add it to your Theme’s functions.php file but be cautious when adding it without understanding the opening-closing PHP tags.

    Ensure that you’ve created a full backup of your site before you add the code.

    Regards,

    Thread Starter kayapati

    (@kayapati)

    I already added it, but where I see results? I can not see any changes while uploading profile image? where I can I see the changes?

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kayapati

    You can check the uploads folder wp-content/uploads/ultimatemember/ and see if it has generated the custom size for your custom grid templates.

    Regards,

    Thread Starter kayapati

    (@kayapati)

    Great, I see the image is cropped with specified sizes.

    But here 2 minor issues.
    1. When I upload profile image, the Media uploader keep on getting the text message “Keep Processing” when I cancel and save the page the profile image is appear, is any thing missing in the code?

    2. I see the image in “wp-content/uploads/ultimatemember/6/profile_photo-custom.jpg” how to display it in my custom profile template.

    I am trying to know the path of the image but not getting, can you tell me how to display the image either in member-grid.php which I located in my theme to customize it as per my needs.

    Thank you for your help.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kayapati

    You only need the user ID to display the custom profile photo:

    <img src="https://www.yoursite.com/wp-content/uploads/ultimatemember/<insert user id>/profile_photo-custom.jpg"></a>

    Regards,

    Thread Starter kayapati

    (@kayapati)

    Champ

    Its working fine in Local server but when I upload it into liver server which is WP Multi-network sites, its not working.

    My live image upload looks like this:

    https://kayapati.com/demos/alexia/wp-content/uploads/sites/151/ultimatemember/6422/profile_photo-190×190.jpg?1574948548

    but the custom image path looks like this:
    https://kayapati.com/demos/alexia/wp-content/uploads/ultimatemember/6422/profile_photo-custom.jpg

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kayapati

    You can add the following code:
    $image_path = str_replace("/uploads/ultimatemember/","/uploads/sites/151/ultimatemember/", $image_path );

    After this code:
    $image_path = pathinfo( $image_path, PATHINFO_DIRNAME ) . DIRECTORY_SEPARATOR . $key . '-custom.' . pathinfo( $image_path, PATHINFO_EXTENSION );

    Regards,

    • This reply was modified 5 years, 3 months ago by Champ Camba.
    Thread Starter kayapati

    (@kayapati)

    I have added the above code, but it still not working.

    Check this my live site you can see the image not working above the original image.

    THis is my live site:
    https://kayapati.com/demos/alexia/user/ramram/

    Check this image draft

    • This reply was modified 5 years, 3 months ago by kayapati.
    Thread Starter kayapati

    (@kayapati)

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kayapati

    How do you display the profile photo with custom size? Do you add it directly to the custom Profile Template?

    Regards,

    Thread Starter kayapati

    (@kayapati)

    no, I am using Custom Template but the action hook is same. I just custom Template for styling purpose.

    This is the code from which the profile photo is coming.
    do_action( ‘um_profile_header’, $args );

    Thread Starter kayapati

    (@kayapati)

    Sorry, ignore the above message,

    The below code in theme function.php

    add_filter("um_upload_image_process__profile_photo","um_custom_profile_photo_size", 1, 7 );
    function um_custom_profile_photo_size( $response, $image_path, $src, $key, $user_id, $coord, $crop ){
      
    			$quality = UM()->options()->get( 'image_compression' );
    
    			$image = wp_get_image_editor( $image_path ); // Return an implementation that extends WP_Image_Editor
    
    			$temp_image_path = $image_path;
    			//refresh image_path to make temporary image permanently after upload
    			$image_path = pathinfo( $image_path, PATHINFO_DIRNAME ) . DIRECTORY_SEPARATOR . $key . '-custom.' . pathinfo( $image_path, PATHINFO_EXTENSION );
    
    			$image_path = str_replace("/uploads/ultimatemember/","/uploads/sites/151/ultimatemember/", $image_path );
    
    			if ( ! is_wp_error( $image ) ) {
    				
    				$image->resize( 275, 325, true );
    				
    				$image->set_quality( $quality );
    
    				$image->save( $image_path );	
    				
    			}
    		 }

    and the below one added in custom template.

     $profile_image_path = um_user_uploads_uri() . ('profile_photo-custom.jpg');
     echo "<img src=".esc_attr ($profile_image_path).">";

    This is working fine with local server. but when I upload into my live site which is mutlinetwork, not working.

    • This reply was modified 5 years, 3 months ago by kayapati.
Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘I badly need to make the Profile image hight more than width’ is closed to new replies.