max size of images

Home Forums Calendar Products Community Events max size of images

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1614645
    karenk
    Participant

    I would like to limit the size of the images that can be uploaded by users. Can you let me know how to accomplish this.

    #1615593
    Courtney
    Member

    Hey Karen

    You can definitely customize that setting. My teammate has answered just how to do that at https://theeventscalendar.com/support/forums/topic/image-size-limit/#post-1112895. Take a look and let us know how it goes.

    Thanks
    Courtney πŸ™‚

    #1615920
    karenk
    Participant

    Hello Courtney,

    Thank you for your reply.

    Do I understand it correctly that I have to:

    1. copy the image.php file to events/views/community/modules/

    2. find line $size_format = size_format( wp_max_upload_size() );

    3. change it to $size_format = size_format( 4194304 );

    #1616050
    Courtney
    Member

    Hey Karen

    That is correct. This will give you an image upload size of 4mb (4194304 bytes).

    Thanks
    Courtney πŸ™‚

    #1621680
    karenk
    Participant

    I’m not clear on the following.

    I should put the image.php in a directory under my child theme right? Because the directory I’m reffering to under point 1 is the original file.

    Can you please specify where to put the file exactly.

    #1622233
    Courtney
    Member

    Hey Karen

    You may want to look over our Themer’s Guide for setting up overrides. This will help you create the directory and ensure that future updates don’t wipe out your customizations.

    Yes, a directory within your child theme.

    Thanks
    Courtney πŸ™‚

    #1622769
    karenk
    Participant

    If I put the file into the directory where the themers guide refers to under my child theme
    (in the directory tribe-events\community\modules) it is not working.

    In the original image.php file the line that you refer to is not there. There is a line that looks simular

    $size_format = size_format( tribe( ‘community.main’ )->max_file_size_allowed() );

    However if I change the max file size allowed to 4194304 the template is not functioning properly anymore.

    I would appreciate it, if before you point me to “old” tutorials, you would check to see if it is still applicable to the current version.

    my question:

    1: what do I change in the image.php file so the maximum size of images can be limited.

    2: where do I put the file under my child theme, seeing that the directory referred to in the themers guide is not working

    Thanks in advance,
    Karen

    #1624750
    Courtney
    Member

    Hi Karen

    So sorry for the delay. I was testing out the solution Hunter offered and found a way to still achieve this for you.

    Add this snippet to either your child theme’s functions.php file, , a custom plugin, or use the My Custom Functions plugin.Β 

    add_filter( 'tribe_community_events_max_file_size_allowed', function() {
        return 1048576; // 1MB
    } );
    

    I’ve tested this, and it does alter the image upload size Community Events permits.

    Important notes: Community Events does not control the server, so if the server is configured to only allow 524288 bytes then that is all that will get through (in this case, for you, I doubt that will be an issue, but worth bearing in mind).

    If you need further help with this custom work, please see our Custom Development resource area.

    Thanks
    Courtney πŸ™‚

    #1625685
    karenk
    Participant

    Hi Courtney,

    Yesss its working!

    Thank you very much. I’m very happy that it is solved.

    #1625719
    Courtney
    Member

    Thanks Karen. Glad you got this working.

    I’ll close out this thread for now but let us know if you have any other questions.

    Thanks
    Courtney πŸ™‚

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘max size of images’ is closed to new replies.