Help with sizing uploaded image

Home Forums Calendar Products Community Events Help with sizing uploaded image

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #55737
    Daniella
    Participant

    Hi,
    Is there a way to crop/scale down the size of uploaded images? Some images users are uploading are quite large. Thank you.

    #55748
    Barry
    Member

    Hi Daniella,

    I believe they are automatically resized according to the WordPress image settings (and to match any sizes defined by your theme or other plugins).

    You can then dictate which of these sizes is shown to the end user by tweaking the single-event.php template (read up on themeing best practices first of all if you haven’t already done so!).

    The line of code you would probably wish to change (within single-event.php) is this one:

    <?php echo tribe_event_featured_image(); ?>

    Which you might change to:

    <?php echo tribe_event_featured_image(null, 'medium'); ?>

    If for instance you wanted to display the medium sized version of the image. Does that help?

    #55857
    Daniella
    Participant

    Maybe. What about limiting the size the user uploads in the first place from the form?

    #55897
    Barry
    Member

    That’s a possibility, but right now our plugin simply follows the current practices of WordPress itself. If you feel strongly that it should be something our plugin should solve then definitely feel free to create a feature request for this:

    https://tribe.uservoice.com/forums/195723-feature-ideas

    Otherwise you would need to introduce a customization or workaround specific to your needs, whether that is an automated approach where the original size is deleted after upload (when and only when it comes through the community submission form), or else substituting a different upload mechanism that can crunch down and resize large images before they even leave the browser.

    #55908
    Daniella
    Participant

    The former sounds like a good idea: “an automated approach where the original size is deleted after upload (when and only when it comes through the community submission form)”. How would I accomplish that?

    #55973
    Barry
    Member

    I’d love to help with that, but right now I can’t – we’re simply swamped with support requests right now and so a “nice-to-have” but what I understand to be non-essential customization like this unfortunately would have to wait until we have greater support bandwidth (and, it may be it is beyond the scope of support that we can offer in any case).

    In broad outline though you might add a listener for the save_post action, determine if it is an event (and one being submitted via the community form), then loop through any attachments and delete the original sizes (for which your code may need to wait until a later point in the lifetime of the request).

    I appreciate that’s a very high overview completely lacking in detail, nor is it the only strategy, but it could form part of a briefing if for instance you outsourced this work to an independent developer.

    Cheers,

    Barry

    #56068
    Daniella
    Participant

    I understand. Thank you.

    #56417
    Barry
    Member

    Not at all, sorry we can’t do more right now.

    #979342
    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 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Help with sizing uploaded image’ is closed to new replies.