Ready to get started?Download WordPress


Comment Pub
[resolved] Don't crop, move upload dialog (4 posts)

  1. bryanbrazil
    Posted 2 years ago #

    Nice plugin, great work!

    Would it be possible to set only the desired image width and then resize the image, not crop it to a width/height? So the image would have a fixed width and variable height.

    Also, is it possible to move where the upload dialog is displayed on the comment form? Rather than have it above the comment textarea, I would like to move it below.



  2. bryanbrazil
    Posted 2 years ago #

    I figured out how to move the dialog by changing the hook to comment_form_before.

  3. akirablaid
    Posted 2 years ago #

    Hey Brian I just worked a simple fix.

    In comment_pub.php
    There are several functions for resizing, because of version changes. I had to change a few.

    First part of fix:
    $file_destination = image_resize( $current_file, $imgw, $imgh, true );
    $file_destination = image_resize( $current_file, $imgw, $imgh, false );
    function reference here: https://codex.wordpress.org/Function_Reference/image_resize
    But it seems this is the outdated part of the function. Further work necessary.

    there's another function uner the comment
    //Since WP 3.5 image_resize is deprecated

    find this line:
    $image->resize( $imgw, $imgh, true );
    change to
    $image->resize( $imgw, $imgh, false );

    Now, since the third parameter, crop, is off by default, and because I have no need of cropping height, only width, I rewrote this to:
    $image->resize( $imgw );
    Simple. Keeping the $imgh and setting the max at 2,000 or so ensures no super-tall content, but the resizing conveniently chops off any excess white space.

    Hope this helps!

  4. nowmediagroup
    Plugin Author

    Posted 1 year ago #

    Hello bryanbrazil,

    I'm so sorry I didn't get to answer your question. akirablaid's solution should work, I decided to leave the image_resize function since 3.5 was still new but I'm going to stop supporting 3.4 when 3.6 is launched.

    Again sorry bryanbrazil I couldn't get to your post, I didn't know I needed to subscribe to my plugins feed to get my plugins support emails.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.