• Hi, First of all I have to thank you for this plugin. It solves media upload in a brilliant and simple way, keep it simple that’s my motto.

    It is good that only one original image is stored on FTP. But I would need it to automatically resize when someone uploads an image larger than 1000 px, so I would like the image to be automatically cropped and saved. Is there any php snippet for this?

    My second question is how to set the maximum file size of videos, music and images. Let’s say I allow a maximum of 20MB file upload per post each time. How to do it? I couldn’t find it in the plugin settings.

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mathieu Viet

    (@imath)

    Hi @testovac,

    The BP Attachments Add-on uses the BuddyPress plugin Attachment API which in the end uses wp_handle_upload(). In BuddyPress the image dimensions edit is something we perform for the local avatar feature (in bp_core_avatar_handle_upload()). What we do is replacing the original image, once downloaded, with a cropped one. I understand your need and I believe it can be useful for users but I’m afraid there are no filters/actions to hook to at the best moment to do it with a PHP Snippet. I’ve opened this issue https://github.com/buddypress/bp-attachments/issues/83 and we’ll work on it to make it easier to achieve.

    For the second part of your feedback, as I’ve said this Add-on is using the BuddyPress plugin Attachment API. You can control the max upload file size filtering the BuddyPress function bp_attachments_get_max_upload_file_size() when the type is a media for example:

    function testovac_attachments_get_max_upload_file_size( $size, $type ) {
    	if ( 'media' === $type ) {
    		// 2mb.
    		$size = 2048000;
    	}
    
    	return $size;
    }
    add_filter( 'bp_attachments_get_max_upload_file_size', 'testovac_attachments_get_max_upload_file_size', 10, 2 );
    Thread Starter testovac

    (@testovac)

    I am sorry, but its not works for me (i set 100MB), when i want upload mp4 (71MB) file:

    screenshot:

    https://ibb.co/m8kdNPf
    https://ibb.co/dGThQ58

    Thread Starter testovac

    (@testovac)

    Is there a plan to do function “set a max limit for each type of file” in the plugin settings?

    I have tried to find thousands of tutorials and articles on how to raise wordpress upload options for buddypress but nothing works for me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Automatic resize of upload images ???’ is closed to new replies.