Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Jaremilus

    (@jaremilus)

    done 🙂

    function resize_profile_image() {
    
    	if ( current_user_can( 'manage_options' ) ) {
    		$user_id = bp_displayed_user_id();
    	} else {
    		$user_id = bp_loggedin_user_id();
    	}
    
    	add_filter( 'bxcft_show_field_value', 'resize_img_path', 15, 4);
    	function resize_img_path($img_path, $type, $id, $value) {
        	if ($type == 'image') {
            	$value = str_replace("<p>", "", $value);
            	$value = str_replace("</p>", "", $value);
            	$img_path = $value;
        	}
        	return $img_path;
    	}
    
    	$img_path = xprofile_get_field_data(213, $user_id);
    
    	$image = wp_get_image_editor( ABSPATH.'wp-content/uploads'.$img_path );
    		if ( ! is_wp_error( $image ) ) {
        		$image->resize( 720, 175, true );
        		$image->save( ABSPATH.'wp-content/uploads'.$img_path );
    		}
    
    	remove_filter( 'bxcft_show_field_value', 'resize_img_path', 15, 4);
    }
    add_action( 'xprofile_updated_profile', 'resize_profile_image' );
    Thread Starter Jaremilus

    (@jaremilus)

    or how to resize image before save??

    @autor yeah – i used 1.6 beta when i posted that, now work fine – stable 1.6 🙂

    Thanks!

    I need that too – best option is to convert:

    <div id="mega-menu-wrap-topbar" class="mega-menu-wrap"><input id="mega-menu-toggle-topbar" class="mega-menu-toggle" type="checkbox"></input><label for="mega-menu-toggle-topbar"></label><ul><li></li></ul></div>

    into:

    <div id="mega-menu-wrap-topbar" class="mega-menu-wrap"><a href="javascript:void(0)" id="toggle"><i class="toggle-ico"></span>Menu</a><div id="toggle-content"><ul><li></li></ul></div></div>

    and add jquery:

    jQuery.noConflict()
    jQuery(document).ready(function(){
        (function($){
    	$('#toggle').click(function(){
        	$('#toggle-content').slideToggle();
        });
        })(jQuery);
    });
Viewing 4 replies - 1 through 4 (of 4 total)