Home › Forums › Calendar Products › Community Events › max size of images
- This topic has 10 replies, 3 voices, and was last updated 5 years, 7 months ago by karenk.
-
AuthorPosts
-
September 5, 2018 at 2:16 pm #1614645karenkParticipant
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.
September 6, 2018 at 12:33 pm #1615593CourtneyMemberHey 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 πSeptember 6, 2018 at 11:50 pm #1615920karenkParticipantHello 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 );
September 7, 2018 at 4:47 am #1616050CourtneyMemberHey Karen
That is correct. This will give you an image upload size of 4mb (4194304 bytes).
Thanks
Courtney πSeptember 14, 2018 at 12:35 am #1621680karenkParticipantI’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.
September 14, 2018 at 10:49 am #1622233CourtneyMemberHey 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 πSeptember 15, 2018 at 1:41 pm #1622769karenkParticipantIf 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,
KarenSeptember 18, 2018 at 12:51 pm #1624750CourtneyMemberHi 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 πSeptember 19, 2018 at 12:06 pm #1625685karenkParticipantHi Courtney,
Yesss its working!
Thank you very much. I’m very happy that it is solved.
September 19, 2018 at 12:30 pm #1625719CourtneyMemberThanks 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 π -
AuthorPosts
- The topic ‘max size of images’ is closed to new replies.