Image size limit

Home Forums Calendar Products Community Events Image size limit

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1112582
    William
    Participant

    Hello!

    Like a previous poster, I’d like to limit image size for users using the add an event form.

    https://theeventscalendar.com/support/forums/topic/event-image-size-limit/

    In that thread the mod suggested adding

    <input type=”hidden” name=”MAX_FILE_SIZE” value=”4194304″ />
    (that is in bytes and is 4mb limit)
    to this file after moving it to your theme per the themer’s guide:

    I’ve placed the file in the correct area of my theme to make modifications. But where would I place that code in the file? I confess I’m not even sure how it’s supposed to work since it’s hidden. There’s still going to be a the bit of code referring to the php upload limit specified by my host.

    #1112895
    Hunter
    Moderator

    Hey William,

    Welcome back 🙂

    You’ll need to create a custom template containing the line of code you provided. Please review our Themer’s Guide. We provide information and examples on how to overwrite existing files so the changes you need are displayed and saved properly when updating to newer versions.

    There are videos on YouTube that also give great visual examples on how to create custom templates. This one helped me out a lot. It seems complicated at first, but once you dig in a bit, I can honestly tell you it’s not too difficult to catch on.

    The file you’ll need to overwrite is: the-events-calendar-community-events\views\community\modules\image.php

    Add the line of code to the new file you created and saved in your-theme/tribe-events

    <input type=”hidden” name=”MAX_FILE_SIZE” value=”4194304″ />

    Best of luck with the template override and thanks for choosing Community Events!

    #1113581
    William
    Participant

    Thanks for the reply.

    I was able to place the edited file in the right location. My question was where to put the code snippet in image.php. Just anywhere? In place of something else?

    Then it occurred to me you might have meant to make a file consisting just of that snippet, name it image.php and place it the correct location. I noticed that was having an effect (because a typo made it stand out) but once the typo was fixed, the image upload area just disappeared.

    As an additional note, I noticed you said place the file under tribe-events/. Just to clarify, I’m supposed to create a subdirectory /modules under that right? I tried both ways and the /modules was the one that showed changes, so I assume so.

    I did manage to get the limit to change by editing line 20 of image.php

    $size_format = size_format( wp_max_upload_size() );

    to

    $size_format = size_format( 4194304 );

    Though perhaps that’s not the best way?

    #1113972
    Hunter
    Moderator

    Hey William,

    I also tested by doing adding <input type=”hidden” name=”MAX_FILE_SIZE” value=”4194304″ /> to the events/views/community/modules/image.php file but unfortunately don’t have much time to test why it’s not working.

    Regardless, by altering the line you did, it appears to work for me as well. I can’t say whether it’s the best way, but it is working and I didn’t see any errors in my console so I’d go with it until you find a better route. Make sure you’ve saved it in your tribe-events folder that is inside your theme folder so it won’t be overridden when you update our plugin.

    And yes, you do need to have the “modules” folder in order for the overrides to apply. I hope I’ve sufficiently answered your questions and thanks for the patience while we got to a resolution. Take care 🙂

    #1119774
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Image size limit’ is closed to new replies.